0
$\begingroup$

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

  1. Open an existing file A.
  2. Link an existing B file using a Link link.
  3. 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.

$\endgroup$
0
$\begingroup$

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
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.