I am trying to build a collection hierarchy in bpy - to mirror a product's hierarchical bill of materials.
With a mesh I can do this:
obj.users_collection
to find out what collections object obj is part of.
How do I do that with a collection? if I do
coll.users_collection
I get an error:
'Collection' object has no attribute 'users_collection'
and
coll.users_dupli_group
(which was my best guess) returns an empty list, and not at least the root collection as I expected: a behavior that is different from plain Objects.
So what should I use instead?
For context - I am trying to do the following:
- create a new collection "A"
- add an existing collection "B" to the new collection "A"
- if the existing collection was in some other collection (including the top one), unlink it so "B" is in one collection only - that is, in "A"
This last step fail - as I can't seem tell what collections a collection is in.