Python: Keying the focal length (Blender 2.75)

Hello Guys,

i am working on a addon for Blender.
One the i want to keyframe with this Addon is the focal length of the camera.

But i do have a problem with the parameter of the camera:

>>> bpy.context.object.keyframe_insert(data_path=“lens”, frame=bpy.context.scene.frame_current)
Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
TypeError: bpy_struct.keyframe_insert() property “lens” not found
>>>

This says that “lens” is not found. Looking into Graph Editor it says that the RNA Path is “lens”.

Does anyone know what the problem is?

Greeting,
biteworks

Problem solved:
bpy.context.object.data.keyframe_insert(data_path=‘lens’,frame=1)

The Data was missing :wink: