Library loading using bpy.data.temp_data()

Does anyone understand how to properly use bpy.data.temp_data() to create temporary data for loading libraries?

API reference: https://docs.blender.org/api/current/bpy.types.BlendData.html#bpy.types.BlendData.temp_data

Diff: https://developer.blender.org/rB9e0921497912cbfe9846358d1cb1220f88315f80

1 Like

Hi,

If other folks are lost in this topic, here is a start answer.

You can indeed use the temp_data to access external blend file data without worrying about the current blend file. Seems like a super useful feature! :slight_smile:

You can use it this way:

import bpy

filepath = '/my/path/my_blend_file.blend'

with bpy.data.temp_data(filepath=filepath) as temp_data:
    objects = temp_data.objects