I'd like to Append an object using a python script, and do it in Blender2.8. I have found some code snippets to do this on 2.7x but having trouble on 2.8.
Below is what I tried. I get this error on the last line: AttributeError: 'bpy_prop_collection' object has no attribute 'link'
Thanks for any suggestions or code snippet. I am beginner level on Python, and intermediate level on Blender.
Matt
# current scene
scn = bpy.context.scene
# path to the blend
filepath = "//2019_template_01.blend"
# name of object(s) to append or link
obj_name = "Chassis"
# append, set to true to keep the link to the original file
link = False
# link all objects starting with 'Chassis'
with bpy.data.libraries.load(filepath, link=link) as (data_from, data_to):
data_to.objects = [name for name in data_from.objects if name.startswith(obj_name)]
#link object to current scene
for obj in data_to.objects:
if obj is not None:
scn.objects.link(obj)