Is there a way to duplicate view3d area into a new window from a script? This is how it's done through the UI: blender docs. I want to have a separate window with only the 3d viewport.

found this operator:


but it gives:

ERROR (wm.operator): /home/sources/blender-release/source/blender/windowmanager/intern/wm_event_system.c:1459 wm_operator_invoke: invalid operator call 'SCREEN_OT_area_dupli'

found this for blender 2.79: New window with Python API?


1 Answer 1


The operator still works in 2.80, but you need two parameters:

  1. A custom context that tells the operator what area should be used for the new window
  2. The correct execution context

The custom context can be created by modifying a copy of the current one. The area object for the 3D view can be found by iterating through bpy.context.screen.areas and checking for the type to be 'VIEW_3D'.

Executing bpy.ops.screen.area_dupli(context) will not work properly, because EXEC_DEFAULT is used as the default execution context. When this is the case event->customdata is NULL (see screen_ops.c) which results in the operator returning PASS_THROUGH and no window being created. The solution is to add INVOKE_DEFAULT as argument, which is exactly what the button in the user interface does.

import bpy

context = bpy.context.copy()

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        context['area'] = area
        bpy.ops.screen.area_dupli(context, 'INVOKE_DEFAULT')
  • $\begingroup$ Sorry, it took a long time for me to notice. I took a break from it as it was a roadblock to my addon development. I'll test those out as soon as I can. Thanks very much for the detailed and clear answer. $\endgroup$ Commented Oct 29, 2019 at 5:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .