I am trying to render objects from each collection by loop but it only renders one collection.
import bpy
# hide all the collections
for col in bpy.data.collections:
col.hide_render = True
for col in bpy.data.collections:
# unhide the collection
col.hide_render = False
bpy.ops.render.render(write_still=True)
# hide the collection
col.hide_render = True
# unhide all the collections
for col in bpy.data.collections:
col.hide_render = False
bpy.context.scene.render.filepath
. see this answer for proper usage. $\endgroup$