Getting parent of collection

To get child of collection there is: collection.children list
But how to get parent of selected collection?
For now I do:
for coll in bpy.data.collections:
if collection_x.name in coll.children.keys():
do something
But maybe there is better way.

1 Like

There is no function for it, it would be convenient to have. Note that a collection can have multiple parents.

So, is “collection.parents” going to be added anytime soon? :confused:

3 Likes

I also ran into this today. Would be super useful, instead of having to loop through all collections trying to find the parent.