How to list all collections and their objects? I have a scene with 2 collections of 4 objects each. I am trying to get all collection names and their objects' names. Unfortunately, info panel nor python hints have not been helpful to find the command.
How do I get a list of all collections' names? How do I get a list of all objects' names in a given collection?
You can access all collections through bpy.data.collections. The objects within the collection (and child collections) are given by bpy.data.collections.all_objects. This is documented in the BlendData types and the documentation of the collection type.
A little example script for printing the content of the collections:
import bpy

for collection in bpy.data.collections:
   print(collection.name)
   for obj in collection.all_objects:
      print(&quot;obj: &quot;, obj.name)