I am trying to insert a keyframe at an object's "Follow Path" constraint programmatically. More specifically I am trying to insert a keyframe to the "Offset Factor" property of the constraint. Manually, I would constraint an object to follow a curve, select the desired frame and then right click on "Offset" -> "Insert Keyframe". However, blender's function:
object.keyframe_insert(data_path="location", frame=0)
Does not have a data_path option for the offset_factor. The "location" option is a handle to the object's location at creation (for my case (0,0,0)) and does not change with offset factor change. Is there a workaround or is it not a supported feature? In my code I am trying to set a keyframe at frame 0, offset=0 and at frame 100, offset=1:
constraint_handle.offset_factor = 0
object.keyframe_insert(data_path="location", frame=0)
constraint_handle.offset_factor = 1
object.keyframe_insert(data_path="location", frame=100)