In Python 2.8, I would like to create copies of the object 'CubeTemplate' but am having no luck. I have reviewed every blender.stackexchange post on this subject (this, this, this and this) but cannot get them to work - either they don't apply or the sample code throws errors (perhaps because it was pre 2.8).
The code below throws this error:
AttributeError: 'bpy_prop_collection' object has no attribute 'link'
for x in range(1, 3): bpy.data.objects['CubeTemplate'].select_set(True) bpy.context.view_layer.objects.active = bpy.data.objects['CubeTemplate'] me = bpy.context.object.data # use current object's data me_copy = me.copy() ob = bpy.data.objects.new('CubeCopy'+str(x), me_copy) ob.location = (0, 0, x) scene = bpy.context.scene scene.objects.link(ob) scene.update()