I want to import multiple objects from another .blend file using a python script. What is the best way to do this without having to import every single object?

Example of what i want to import:

Picture shows outliner with different mesh items all parented to house.container and starting with "house"


2 Answers 2


Using BlendDataLibraries # bpy.data.libraries

import bpy

filepath = "//link_library.blend"

# append all objects starting with 'house'
with bpy.data.libraries.load(filepath) as (data_from, data_to):
    data_to.objects = [name for name in data_from.objects if name.startswith("house")]

# link them to scene
scene = bpy.context.scene
for obj in data_to.objects:
    if obj is not None:
  • $\begingroup$ Thanks, it almost works! There is just one problem: When importing a beveled curve (for example like this: prntscr.com/elvbjv) I get this symbol (i think it is for "linked"?): prntscr.com/elvcr7. When i try to edit the Curve Bevel now i get the error "Cannot edit external libdata" and also the animation of the Curve Bevel doesn't show up after importing. $\endgroup$
    – froggyman
    Mar 19, 2017 at 15:45
  • $\begingroup$ Works fine for me, ran a simple test and it appends both curves and bevel objects etc from other blend files. Is Curve.bevel (your picture of which shows SFA) a linked object in your library file $\endgroup$
    – batFINGER
    Mar 19, 2017 at 16:04
  • $\begingroup$ It appended both for me, too. I also just ran a simple test scene but it appended this prntscr.com/elvrr0 instead of this prntscr.com/elvslb. This is a problem because the Animation data doesn't get transferred. All objects were created in the original file. $\endgroup$
    – froggyman
    Mar 19, 2017 at 16:20
  • $\begingroup$ Don't know, works for me and appends (simple test) actions from lib file. Might pay to make a sample lib file. $\endgroup$
    – batFINGER
    Mar 19, 2017 at 16:23
  • 1
    $\begingroup$ Think someone else needs to look at this, as for me your sample files do exactly as expected and append both curves. There is no animation data. $\endgroup$
    – batFINGER
    Mar 19, 2017 at 17:04

You need to use append and choose which object you want to import and which type this object is.

Some of the different types are shown below:

enter image description here

Once you know that then you can use the below python script which is found here to import the object you want from another .blend file

blendfile = 'D:/path_to_blend_file/source.blend'
section   = '\\Object\\'
objects    = ['myobj1','myobj2','myobj3','myobj4','myobj5'] ###<-- Add the name of objects you want to append

directory = blendfile + section

for obj in objects:  
    filename  = obj
    bpy.ops.wm.append(filename=filename, directory=directory)
  • 1
    $\begingroup$ FYI information directory and filename may be enough. See blender.stackexchange.com/questions/74378/… $\endgroup$
    – lemon
    Mar 16, 2017 at 5:30
  • $\begingroup$ Thank you this helped, i don't know how to effeciently import multiple objects with your script. I edit my question to make it more clear. $\endgroup$
    – froggyman
    Mar 16, 2017 at 16:43
  • $\begingroup$ You can look this post blender.stackexchange.com/questions/17876/… $\endgroup$
    – pistiwique
    Mar 16, 2017 at 19:43
  • $\begingroup$ Thanks but i already tried it and it doesn't work with beveled Curves somehow $\endgroup$
    – froggyman
    Mar 16, 2017 at 19:45
  • $\begingroup$ @froggyman answer updated. You include the object names you want to append in the objects list $\endgroup$
    – Tak
    Mar 16, 2017 at 23:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .