How to get a var from another node on a func?

Is there a way to access a script var, in another scene using a func ?
i keep getting an error

Invalid access to property or key ‘prevState’ on a base object of type ‘Node2D (plrIdle.gd)’.

@export_subgroup("Handle Node")
@export var handleNode: Node2D 

func _changeState( prevState, _stateName ):
	print(handleNode.prevState)

prevState is used has state in the other script:

func move( idleState ):
	skel._changeState( state, stRun );

If i do this ( handleNode.state ) everything works fine: print is Zero

@export_subgroup("Handle Node")
@export var handleNode: Node2D 

func _changeState( prevState, _stateName ):
	print(handleNode.state)

Parent node is “characterBody2D”… the script is in node2D, so using class is always useless…

Does plrIdle or script have a property prevState or var prevState defined?

thanks,
it doesnt have
prevState, and _stateName are going looking for this. In node2D plrIdle

enum {
	stIdle,
	stWalk,
	stRun,
	stJump,
	stJumpGo,
	stCrouch,
	stCrouchOut,
	stDodge,
	stWalkOff,
	stExit
	}

var state = stIdle;

but ive already fixed…

func _changeState( _stateName ):
	animPlayTimes = 0;
	anim_delayReset = true;
	animDelay.start(150);
	anim_delay2 = 150;
	rootUpperBodySet = false;
	
	return _stateName;

I wanted to use the vars prevState != _stateName on that func so i could skip this if in the main script:

				if ( state != stRun ):
					state = skel._changeState( stRun );