How to append an object from another blend file to the scene using the Blender Python API

The Blender Python API provides the ability to append or link objects from another *.blend file to the current scene using the “append” command.

To append an object (for example – a mesh) from another .blend file, we need to do the following:

  1. Specify the full path to the blend-file from which to get an object.

  1. Specify the relative path to the required object in the internal hierarchy of the blend file.

  1. Specify the name of the required object.

  1. And execute the “append” operator with three required parameters:

After executing this code, by clicking the “Run Script” button, we will append the “Suzanne” mesh from the specified 11.blend file into the current scene.

Full code:

5 1 vote
Article Rating
Subscribe
Notify of
guest

8 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
hannes
hannes
3 months ago

this is legacy code, using operators is best avoided since it doesn’t run correctly sometimes.

the new way is using BlendDataLibraries https://docs.blender.org/api/blender_python_api_2_77_1/bpy.types.BlendDataLibraries.html

hannes
hannes
3 months ago
Reply to  hannes

example:

JunoMars
4 months ago

While this code is nice and neat, I can’t get it to work. What am I doing wrong?

Peter MOUEZA
1 year ago

How to do if we don’t know object name ?

Lawrence D’Oliveiro
Lawrence D’Oliveiro
1 year ago

The filepath argument is not necessary.