Python script renders a collection even when excluded from view layer I have the following code to render child collections within a collection:
sideplates = bpy.data.collections[&quot;RACK 1 - 1 RACK FRAME&quot;].children

for s in sideplates:
    s.hide_render=False
    s.hide_viewport=False
    n = s.name
    
    # render 800 x 600 
    
        scene.render.resolution_x = render1xresolution
        scene.render.resolution_y = render1yresolution            
        bpy.data.scenes[&quot;CONFIGURATOR 800 x 600&quot;].render.filepath = '/BlenderPythonTest'
        bpy.ops.render.render(write_still = 1)
         
    s.hide_render=True
    s.hide_viewport=True

The collection structure looks like this:

I have tried to untick the box, excluding the child collections from the parent collection. Running the script will still render the &quot;Nuage&quot; collection et al, when what I would like from the picture above is just to render &quot;Sable&quot;, &quot;Souquillou&quot; and &quot;Cab&quot;.
Is this possible and if so, how?
I did this recently, you have to access your collection through specific view layer.
You should try :
my_view_layer = bpy.context.view_layer #up to you

#append to sideplates only checked collection
sideplates = []
for collection in my_view_layer.layer_collection.children[&quot;RACK 1 - 1 RACK FRAME&quot;].children :
    if collection.exclude == False :
        sideplates.append(collection)

##render individually checked collections
for s in sideplates:
    
    #exclude every other collection
    for sp in sideplates:
        if sp != s :
            sp.exclude = True
            
    ## RENDER STUFF ##
    
    #restore exclude attribute
    for sp in sideplates:
            sp.exclude = False