Invalid call - nonexistent function

yes it is

waiting for a reply again

Does theghost node script extends Sprite2D?

yup, it does

Change the line that defines ghost_body back to:
@onready var ghost_body = $theghost as BodySprite

On theghost node script extend from BodySprite instead of Sprite2D.

Then try to see if the error still happens.

i did both but the theghost node script gets an error when i make it extend from bodysprite so i kept it as sprite2d

what was the error? The same error?

no its a different error
but the main issue is now fixed

and the error with the theghost node script is also gone

What did you do? Did it just fix itself, magically?

yea i guess

Then I suspect there was a typo somewhere that you removed with all the back and forth coding. Only plausible explanation.