Jump Timeline one Frame with Python


I am trying to set keyframes to the start and ONE FRAME AFTER the end of the scene.

I tried this but it doesn’t work:

bpy.context.object.keyframe_insert(data_path=‘constraints[“Follow Path”].offset’, frame=frame+1)

It told me that the “frame=” is of a “set” kind. Is there a way in python to jump one frame?

I could manage it with this code:

bpy.data.scenes[‘Scene’].frame_end += 1

before adding the keyframe:

bpy.context.object.constraints[“Follow Path”].offset = 100
bpy.context.object.keyframe_insert(data_path=‘constraints[“Follow Path”].offset’)

and then setting the end back to what it was:

bpy.data.scenes[‘Scene’].frame_end -= 1