APPENDING A SCENE THROUGH PYTHON without linking?

Hello all,

I am importing a ‘scene’ through a python script-

bpy.ops.wm.link_append(
filepath= “//myfile.blend”,
filename= “scene”,
directory= “C:/…/myfile.blend/Scene/”,
link=False,
autoselect=1,
active_layer=1,
instance_groups=1,
relative_path=0)

When the scene imports, it is always “linked”!

I am setting “link= False” but the scene is still linked?

when I import through the menu (Shift + F1) and toggle the linked option I can append the scene

What am I missing?

I reported this as bug:

https://developer.blender.org/T38924

Applies to 2.57, 2.61, 2.65, 2.67, 2.69…

You could alternatively try:
http://www.blender.org/documentation/blender_python_api_2_69_10/bpy.types.BlendDataLibraries.html

Don’t use Blender path notation on Windows for the directory to make it work

Bad:
“C:/…/myfile.blend/Scene/”
r"C:…\myfile.blend\Scene"

Good:
“C:\…\myfile.blend/Scene/”
r"C:…\myfile.blend/Scene/"

Ok I did some digging and apparently you can append the scene without it being linked- I can repeat my results but I am not sure what I am switching on and off to do it—>

Step 1:
If I append something in blender (Shift F1), and check the “Link” radio box to “off” in the window manager, the scene is then linked locally.

Step 2:
THEN if I append a scene through python anytime after step 1 and specify that linked is False, then the scene is successfully appended as a local scene-- even if I close the file and open another file and try it again.

My theory is that I am toggling a setting in the winman that prevents scenes from being linked by default. As far as I can tell it’s somewhere in here —>

bpy.data.window_managers[‘WinMan’]…linked

The link-property determines whether a scene is linked or appended:

link=False -> append
link=True -> link

If it links the scene despite link=False, then it’s the above bug. It doesn’t work with non-windows paths on windows (using / instead of )