Invalid call: Nonexistent function 'something' in base 'Node', while function is present.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By FortunePilot2

Hi, I’m having a very annoying problem that I just can’t seem to figure out.

I am trying to access a function in the script of a child using this line:

var save_info = get_node("World").save()

This line gives me the error: “Invalid call. Nonexistent function ‘save’ in base ‘Node’.”

This is my node structure:
Game (
|_ World (

My script:

class_name GameWorld
extends Node

func save():
    var something = value
    return something

Does anyone know what’s going wrong here?

Thanks in advance.

Also: Instead of get_node("World"),save() can use $

or even better save world so can use it any time without doing a costly get_node

onready var _world := $World


rakkarage | 2020-10-13 14:59

:bust_in_silhouette: Reply From: rakkarage

Make class_name same as script name i think:

classname World or

Might have to close and reopen after changing.

:bust_in_silhouette: Reply From: Bernard Cloutier

Looks fine, the problem is probably something else. Try putting a breakpoint on the line var save_info = get_node("World").save() and then checking the remote tab in your editor to validate that you do have a “World” node with the script attached: Overview of debugging tools — Godot Engine (stable) documentation in English

Could you share more? The complete scripts of and, as well as a screenshot of your scene tree?