You can use
current_animation_position to look for the current animation time, and then
seek after changing the animation, to put the animation in that frame... something like this:
var frame = anim_player.current_animation_position
animation = animation_mode + "_" + animation_direction
anim_player.current_animation = animation
However, this will work as long as your animations are the same length... if not, you should check before what animation are you changing to, and perhaps apply another rule, although I guess that when you change from run to idle, is ok that idle starts from zero, right?