You have two ways of changing variables from AnimationPlayer:
Adding export in front of that variable.
This will make the variable accessible from the inspector, and that means you will be able to animate it (which regularly sets this variable when the animation is playing).
Making a setter and call it
If you just want to set the variable in a specific point in time, or if you’re not keen on exposing it in the inspector, you can create a function to set it, like:
var myvariable = 42
func set_myvariable(value):
myvariable = value
Then you will be able to call this function with the wanted value using a Call Func track (write the name of the function, add one argument, set its type to integer, and write the value it should have).