How to get all collections of the current scene? I'd like to get all collections in the current scene and can't find a way to do that. I found bpy.data.collections to get all collections stored in the blend and C.scene.collection.children to return the first level of sub-collections. However, I can't find out which collection is linked to each scene. I wonder if there is a simple way like iterating through the objects in context C.scene.objects?

Q: How to get all collections of the current scene?
Recursively walk the tree.

Similarly to https://blender.stackexchange.com/a/137866/15543 and Sorting Collections Alphabetically in the Outliner

import bpy

def traverse_tree(t):
    yield t
    for child in t.children:
        yield from traverse_tree(child)

coll = bpy.context.scene.collection

for c in traverse_tree(coll):
    print(c.name)