Enable "Animate Path" in python

I am struggling to add the “Follow Path” constraint in my script correctly in 2.80.
First thing I do is adding the new constraint, then enable fixed location, then setting the target curve and all the keyframes.
In 2.79 it used to work just like that, but now the object is not moving on my curve with this. It only moves after pressing “Animate Path” manually.
So to me it seems I should use “followpath_path_animate” in my script to enable it, but I can’t figure out how. It’s either doing nothing or giving an error because of wrong context.

In case anyone has the same problem, I found a solution here:
Adding these lines it works
override={‘constraint’:myobject.constraints[“Follow Path”]}
bpy.ops.constraint.followpath_path_animate(override,constraint=‘Follow Path’)

1 Like