As part of an existing add-on, I'm trying to create an object and add it to the scene using Python. I followed a Blender Cookbook tutorial found here: Three ways to create objects. I use the following code to do so:
emptyMesh = bpy.data.meshes.new('emptyMesh')
theObj = bpy.data.objects.new("object_name", emptyMesh)
bpy.context.scene.objects.link(theObj)
But I get the following error when I try to link theObj
to the scene objects:
AttributeError: 'bpy_prop_collection' object has no attribute 'link'
This works just fine in Blender 2.76-2.79, but doesn't work in the 2.80 test build I downloaded. Was there a change to the Python API? Or is this maybe a bug in the test build?