I use Python for create many objects then give them animation key frame like this (no problem here):
object.location = (x, y , z)
object.keyframe_insert(data_path='location', frame=start, index=-1)
object.location = (x + changeX, y + changeY, z + changeZ)
object.keyframe_insert(data_path='location', frame=end, index=-1)
How change animation become cyclic? I already know graph editor can change it, but how change this use Python for each object when add their key frames? I try:
bpy.ops.graph.extrapolation_type(type='MAKE_CYCLIC')
but Blender tell 'failed, context is incorrect'