# How do I change the focal length of a camera with python?

I am importing a VRML file using Blender command line. I need to change the focal length of the camera using the command line.

How can I do that? I cannot find Python api for this.

Thanks.

## 2 Answers

It's in bpy.data.cameras['name of your camera object'].lens, or camera.angle (thanks @ideasman42).

Note that you must have a camera in the scene.

Ok, I think I got it ..

We can get the focal length by using bpy.data.cameras.values()[0].lens. We can set this value as well.

• bpy.data.cameras.values()[0].lens is better written as bpy.data.cameras[0].lens – ideasman42 Aug 5 '14 at 22:37