This is simply an update to my original (and, over the years, somewhat popular) Python script for switching cameras within an animation based on the frame number in a scene:
This was the original thread:
And here is a link the updated .blend file with the script, which, at least for me, works with Blender 2.78.
This is what the script looks like:
# Simple Camera Switching Example # by RobertT, 2005 # # Updated 8/22/2017 to # work in Blender 2.78 # # Use and adapt this script # however you want :-) import bpy def cameraChanger(scene): s = bpy.context.scene c = s.frame_current if c<46: bpy.context.scene.camera = bpy.data.objects['Camera'] if c>45: bpy.context.scene.camera = bpy.data.objects['Camera.001'] bpy.app.handlers.frame_change_pre.append(cameraChanger)
After the script is run (by pressing the Run button in the Text window, making sure Register is checked), simply switch (e.g. using the cursor left/right keys on the keyboard) between frames 45 and 46.
I’m sure, since my script first appeared, there must be other ways to do this now, but, as before, if this can be of any use to anyone, please feel free to use / adapt this however you wish.