blender 2.8 how duplicate view3d area into new window from script 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:

bpy.ops.screen.area_dupli()


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?
The operator still works in 2.80, but you need two parameters:


A custom context that tells the operator what area should be used for the new window
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-&gt;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')
        break