So it’s a Node3D error, so whatever get_parent() is handing back to the Sprite3D isn’t your RayCast3D, it’s a plain Node3D. That’s why adding the variable to the raycast script didn’t change anything, the sprite is reading off a different node.
I think you need to find out if there’s a Node3D sitting between the two in the scene tree, since it only takes one node in between for get_parent() to land somewhere you didn’t expect. If that’s it you could chain another get_parent(), though an @export var raycast: RayCast3D you drag in from the inspector won’t break if you move things around later.
Also this part in the Sprite3D script is missing an a: set_global_position(pickup.loction)