Creating Override Library via script I've been trying for days to create a script for my addon that does the following things:


Open an existing file A.
Link an existing B file using a Link link.
Create an Override Library on this file.


The problem is that when you open the A file the context disappears and does not allow the command to run

bpy.ops.object.make_override_library

The error message is that the context is incorrect.
finally i've found the solution...

  for w in bpy.context.window_manager.windows:
    if w.screen.name  == "Layout":
      for area in w.screen.areas:
        if area.type == 'VIEW_3D':
          for region in area.regions:
             if region.type == 'WINDOW':
                override = bpy.context.copy()
                override[ 'area'] = area
                override['region'] = region
                bpy.ops.object.make_override_library(override)
                break