I currently have a method that does:
self.myCol = bpy.data.collections.new(self.collection_name) bpy.context.scene.collection.children.link(myCol)
This method creates and adds a new collection to the outliner. Next, I want to create a bunch of cubes and add those cubes to the collection. How can I tell blender to create objects only within that particular collection?
bpy.ops.mesh.primitive_cube_add(collection='name', size=2, location=(0, 0, 0))
Obvious cube_add doesn't have the param for it, so what's the proper way to do this?