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:
to find out what collections object
obj is part of.
How do I do that with a collection? if I do
I get an error:
'Collection' object has no attribute 'users_collection'
(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.