var obj = getparent().getnode("Player")
var dir = (obj.globalposition - globalposition).normalized()
moveandcollide(dir * speed * delta)
If that works it's because your Player node wasn't
_ready() at the time that object was
"When instantiating a scene connected to the first executed scene, Godot will instantiate nodes down the tree (making init calls) and build the tree going downwards from the root. This causes _entertree calls to cascade down the tree. Once the tree is complete, leaf nodes call _ready. A node will call this method once all child nodes have finished calling theirs. This then causes a reverse cascade going up back to the tree's root."