# Set active blender area/region in headless python module

I compiled Blender as python module to be able to do unit testing of a plugin I'm working on. The issue is that bpy.context.area and other context values do not seem to populate so I can't run operators that require a specific area (like bpy.ops.screen.region_quadviews()).

How do I set the active area and region in Blender?

• Related – batFINGER Sep 28 '17 at 5:01
• If your running in headless mode then there are no screen regions to work with. Maybe setup two testing steps, one without gui and one with. – sambler Sep 28 '17 at 8:23
• @sambler The regions exist, you can explore them in bpy.data.screen.areas and further. There's just no way to set any sort of active one. I've tried using cursor_warp to place the "cursor" over them, as well as some other ones that talk about "cycling the context" but nothing seems to work. There might be a new function in 2.79 that handles it that I'm rebuilding to test out – Coburn Sep 29 '17 at 2:56
• As has been quoted from a blender developer "when in background mode there is no window or opengl context" for any screen region to exist in, that is what leads to no screen regions being available, even though the properties exist, that doesn't mean there is any valid data that can be used. – sambler Sep 29 '17 at 5:47
• Hmm, I think that I might just be able to get away with faking a context and passing it to my class like you've provided in the link. I think that's the only way to go for now – Coburn Sep 29 '17 at 6:00