I want to change the DoF distance of the active camera in a scene using a script. So far I have written:
bpy.data.cameras[0].dof_distance = distance #"distance" is the variable I want to use
But that sets the DoF distance for the camera that comes first in the outliner (alphabetically), which is not necessarily the active one.
So I tried getting the active camera property from the scene settings using
bpy.context.scene.camera.dof_distance = distance
But that does not work at all, because this method only returns the object, but not the "camera-properties" (as far as I get it).
How can I make this work?