How to link a new object to a scene in Blender 2.80 Python API

In Blender 2.79 Python API we can add a new object to a scene with:

If we try to do this in Blender 2.80, it throws an error:

‘bpy_prop_collection’ object has no attribute ‘link’

In Blender 2.80 API new objects mast be linked not to the scene, but to the scene collections:

To link a new object to the active scene collection:

To link a new object to the collection by its name:

 

0 0 votes
Article Rating
Subscribe
Notify of
guest
3 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
fragro
fragro
7 months ago

Gracias…….. familia blender

Terefere
Terefere
11 months ago

you can also assign object to a scene without using context, by:

Last edited 11 months ago by Terefere
NikitaD
Admin
11 months ago
Reply to  Terefere

Yes. Thank you!