import bpy    
Cam= bpy.context.scene.camera      
collections = bpy.context.view_layer.layer_collection.children
for collection in collections:
    if collection.name == Cam.name:
        bpy.context.view_layer.active_layer_collection = collection

This is the original code that can set collection active. now if the collection has children collection(as shown in pic). how to set collection children("collection 10" or "collection 11") as active collection via python?

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.