Scripting: Blender Window
There is a hierarchical setup for a blender window with the Window Manager on the bottom.
import bpy
# Get Windows
wm = bpy.context.window_manager
for win in wm.windows:
print(win)
# Get Areas
for area in bpy.context.screen.areas:
print(f"{area.type:<13} at {area.x:>4}, {area.y:>4} and {area.width:>4}, {area.height:>4} size")
Splitting an area
Works from Blender 3.2 on:
import bpy
for area in bpy.context.screen.areas:
if area.type == 'IMAGE_EDITOR': # 'VIEW_3D', 'CONSOLE', 'INFO' etc.
with context.temp_override(area=area):
bpy.ops.screen.area_split(direction='VERTICAL', factor=0.3)
break
(from stackexchange)
Joining two areas
Sadly this isn't working up to Blender 3.3 according to Harleya from the blender forums.