Can't access sibling node for follower program

Godot Version

4.3

Question

I can’t seem to access the sibling node (the player), I need this for a follower script. Below is my last attempt to find the player.

extends CharacterBody2D

var grav = 1000.0
var spd:float = 100 #Change as required  


func physics_process(delta):    
	var player = get_node("root/Game/Player")
	if player:
		print("hi")
	look_at(player.global_position)
	self.position = lerp(self.position,player.global_position,spd)

Could you use an @export variable instead?

@export var player: Node

func _physics_process(delta: float) -> void:
    look_at(player.global_position)
    self.position = position.move_toward(player.position, speed * delta)

You can also add the player object to a group, then easily locate it:

var player = get_tree().get_first_node_in_group("group_name")

I tried this one, the print statement didn’t respond and the follower did not move. I don’t know how to use export correctly, which is why I had trouble implementing the other solution.

extends CharacterBody2D

var grav = 1000.0
var spd:float = 100 #Change as required  


func physics_process(delta):    
	var player = get_tree().get_first_node_in_group("Party")
	if player:
		print("player is true")
	look_at(player.global_position)
	self.position = lerp(self.position,player.global_position,spd)

Your func _physics_process is missing the leading underscore. It’s not an override so it won’t be run every frame.