Parent collection

In the Blender Python API, a collection does not have a direct pointer to its parent collection. However, we can get the parent collection by searching through the list of children of each collection in the scene until we find the current one.

Parent collection

The list of scene collections can be obtained with:

But it does not include the top-level scene “Scene Collection” collection. This collection can be obtained with:

Let’s define a full collections list for search:

The current active collection:

Now we can find the parent collection for the currently active collection by looking through our list and getting children of each collection. The collection in the children list of which the desired one is found will be the parent for it.

If the collection has no parent collection, our method will return None.

0 0 votes
Article Rating
Notify of

0 Comment
Inline Feedbacks
View all comments