cameravariable = "cameraname"
list3=bpy.data.cameras.keys()
regex3=re.compile(".*"+cameravariable+".*")
cam=[m.group(0) for l in list3 for m in [regex3.search(l)] if m]
for c in cam :
bpy.context.scene.camera = bpy.data.objects[c]
print("Camera change")
Hey, this is how I access my cameras in my scene and cycle through them, but right now it's looking at the data block name, not the camera object. Which is annoying since sometimes my script will try to make a camera that is in another scene the camera for rendering, which in turn just fail my script. So I have to be careful when copying cameras accross scenes to make sure I rename both the object and the data block, which I tend to forget.
So how can I base my script on the camera objects? Or perhaps more simply how I cycle the cameras INSIDE my scene?