# Appending with bpy.data.libraries.load and drivers

I'd like to append all objects from a specific blend file. Some objects in the blend file have drivers attached. For example z-coordinate of the Cube is equal to z-coordinate of the Empty. I used the following simple code for appending.

import bpy

data_to.objects = data_from.objects

for obj in data_to.objects:


However, drivers don't work after execution of the above code. They start to work if I go to the driver settings and press "Update Dependecies" button.

What is the trick to make drivers work?

Here is the blend file I'm trying to append:

• Well, aside from me having to change context.scene to bpy.context.scene and changing self.filepath to "/var/tmp/untitled.blend", I had no difficulty appending an object with a scripted driver using your script. The fact that you are using self.filepath is very odd (If I wanted a copy of something from the current .blend I'd just duplicate it). You may have to upload your .blend, or at least clean up your code example to rule out the possibility that you are confusing blender. – Mutant Bob Jul 21 '15 at 21:15
• @MutantBob The code snippet was used inside an operator, that is why the code had self.filepath and context instead of bpy.context.scene. I'll update the code, so it works without an operator. – vvoovv Jul 21 '15 at 21:48
• I added a blend file – vvoovv Jul 21 '15 at 22:01
• After testing with the .blend you provided, I'm inclined to call this a straight-up bug. The question is still totally valid because you need a workaround until the coders have time to fix the bug. – Mutant Bob Jul 22 '15 at 15:22

The following code does the trick:

import bpy

# prepare files list for bpy.ops.wm.append(..)
files = []