So I'm following a Youtube tutorial, and I've set up player character as a KinematicBody2D with a simple state machine and AnimationPlayer that has an animation for each State/direction combination the character can be in (AttackUp, AttackRight, RunDown, IdleLeft, etc.).
Basically, if the player hits space, he enters the attack state and goes into the ATTACK state in physicsprocess(). Inside the attack_state() method, an AnimationTree plays the appropriate attack animation in the AnimationPlayer.
During each attack animation(Attack Up, Attack Down, Attack Left, Attack Right), I have a track that calls a method named attackanimationfinished() when the animation is done. This method changes the player state back to MOVE.

(In the move_state function, the state gets changed to ATTACK if the player presses the space bar. I would paste it in but it doesn't format in very readable manner.
func _physics_process(delta):
match(state):
MOVE:
move_state(delta)
ROLL:
pass
ATTACK:
attack_state()
func attack_state():
print("Inside attack_state()")
velocity = Vector2.ZERO
animation_state.travel("Attack")
func attack_animation_finished():
print("Inside attack_animation_finished()")
state = MOVE
I put in print() statements to both attack methods to illustrate what I'm talking about.
As you can see, the AnimationPlayer only calls the method once. However, when I play the game and attack, this happens:

The method is being called twice for some reason.
Now, I don't really understand why the first print() statement is being called so many times either. I assume it has something to do with the length of the animation? I can wrap my head around that, but I can't understand why the second print() statement is executing twice.
The code for this method clearly sets the state back to MOVE, so it shouldn't be making a second pass. Regardless, the game is set up so that the only way the method can be called is through the AnimationPlayer, and the AnimationPlayer can only play it if attack_state() is called!
This isn't causing any actual bugs or weird behaviors at all, it's just something that I noticed when I was debugging my animations. It however is very weird to me. Why is my AnimationPlayer calling this method twice?
Does it have something to do with the fact I'm playing these animations by using an AnimationTree?