How to render from multiple cameras in one go? I have a scaffolding setup with multiple cameras locked on to a target. I plan to use this to render a model from various positions. This loop has worked for everything else such as changing name and adding constraints but I can not get the logic to work for renders.

The filename changes just fine, running context.view_layer.objects.active will report the camera is changed correctly, as does the UI, however, the render output is simply multiple renders of the same camera...it never changes. Is there a different way to force each camera to actively render other than what I have tried here?

obj_in_scene = bpy.context.scene.collection.all_objects

for cam in obj_in_scene:
    if cam.type == 'CAMERA'
        bpy.context.view_layer.objects.active = cam
        file = os.path.join("/home/jruch/", cam.name)
        bpy.context.scene.render.filepath = file
        bpy.ops.render.render(write_still = True)


I have also tried building a dedicated list object to iterate through, but it would not cycle the camera's active status as well the filtered "all object" context I used about. What am I missing here?
Assign the camera object to Scene.camera to make it the active cam of the scene:

import bpy

scn = bpy.context.scene

for obj in scn.objects:
    if obj.type == 'CAMERA':
        scn.camera = obj
        scn.render.filepath = obj.name
        bpy.ops.render.render(write_still=True)