State Machine issue trying to change varialbe in AnimationTree

Godot Version

4.2.1

Question

Hello Peeps,
I’m working on getting my animations to start and change from my State Machine and am running into an issue I’m not sure how to solve.
In my CharacterBody2D I have the code:

@onready var animation_player : AnimationPlayer = $AnimationPlayer
@onready var animation_tree : AnimationTree = $AnimationTree

In my state machine nodes I have a reference variable to the player node:

@export var player : CharacterBody2D

When I try to use this:

player.animation_tree[“parameters/conditions/is_focus”] = true

I get the error:
"Invalid set index ‘parameters/conditions/idle’ (on base: ‘Nil’) with value of type ‘bool’

I copied the “parameters/conditions/idle” from the AnimationTree so I know nothing is misspelled. I am able to access the animation_player I have setup in the same way and make it play and stop animations via code so I’m not sure what I’m doing wrong with the AnimationTree

I think it has to do with how things are loading, it works with the other states as long as I don’t have the idle state one for the enter function which will run when it’s loaded.

this mean either the player or animation_tree is not referenced well