Quick answer: Function "x()" not found in base self is a GDScript compile error: the script calls x() on itself, and neither the script nor the class it extends defines it. The usual cause is Godot 3 code calling a function that Godot 4 renamed (deg2rad is now deg_to_rad, rand_range is randf_range). Otherwise it is a typo, a wrong extends line, or a function that lives on another node and must be called through a reference.
You pasted a snippet from a tutorial, or opened an old project in Godot 4, and the script editor underlines a call in red. The script will not run at all until it is fixed, because this is caught when the script is compiled, before a single line executes. The message is precise once you know how to read it: “base self” means the call has no object in front of it, so Godot looked in this script and its parent classes and found nothing by that name. Below are the causes in the order they actually occur, a table of Godot 3 names checked against the engine’s own rename list, and what the message looks like when the base is something other than self.
- The exact error
- What causes it
- How to find which cause is yours
- Fix 1: replace the Godot 3 name
- Fix 2: call it on the object that has it
- Fix 3: correct the extends line or the class layout
- Fix 4: move the function back to the top level
- When the base is not self
- Using the project converter, and its limits
- How to confirm the fix
- Catching the scripts you did not open
- Related guides
- Frequently asked questions
The exact error
In the script editor’s status bar, and in the debugger when you run the scene:
Parser Error: Function "take_damage()" not found in base self.
When the name is one that Godot 4 renamed, the editor appends a suggestion:
Parser Error: Function "deg2rad()" not found in base self. Did you mean to use "deg_to_rad()"?
In the Output panel and the log file the same failure reads:
SCRIPT ERROR: Parse Error: Function "take_damage()" not found in base self.
at: GDScript::reload (res://player.gd:42)
ERROR: Failed to load script "res://player.gd" with error "Parse error".
This is a static check made by the GDScript analyzer in Godot 4. A script with this error does not load, so every node using it behaves as if it had no script. That is different from the runtime error Invalid call. Nonexistent function 'x' in base 'Node2D', which appears only when the faulty line executes; that one is covered in Invalid call: nonexistent function.
What causes it
- Godot 3 code in a Godot 4 project. A tutorial, an asset or an upgraded project calls a global or node function that was renamed or removed in 4.0.
- A typo or wrong capitalisation. GDScript is case-sensitive:
Queue_free(),get_Node()andtakeDamage()are different names from the real ones. - The function is on another node or script.
take_damage()is defined inplayer.gd, and you called it bare fromenemy.gd. - The script extends the wrong class.
extends Nodeat the top, then a call tomove_and_slide(), which belongs toCharacterBody2D. - Indentation moved the function. The
funcline is indented under another function or under an innerclass, so it is not a member of the script. - The function is in a child class. A base script calls a function that only the scripts extending it define.
How to find which cause is yours
The error gives a line and column. Put the cursor on the function name and work through three checks:
- Search the project with Ctrl+Shift+F for
func take_damage. If it turns up in another script, you have cause 3 or 6. If it turns up in this script, check its indentation (cause 5) and spelling (cause 2). - Search the built-in help with F1 for the name. If a class other than your
extendsclass owns it, you have cause 4. If nothing turns up and the code came from an older tutorial, you have cause 1. - Read the first line of the script. A script with no
extendsline extendsRefCounted, which has none of the node functions.
Ctrl+click on a function name jumps to its definition or opens its documentation. If the click does nothing, the editor cannot resolve the name either.
Fix 1: replace the Godot 3 name
These rows come from the rename table the Godot 4 editor itself ships with (renames_map_3_to_4.cpp), plus two removals documented in the upgrade guide. All of them produce “not found in base self” when called without an object in front.
| Godot 3 | Godot 4 |
|---|---|
deg2rad(x), rad2deg(x) | deg_to_rad(x), rad_to_deg(x) |
rand_range(a, b) | randf_range(a, b) (randi_range for integers) |
stepify(x, step) | snapped(x, step) |
range_lerp(...) | remap(...) |
linear2db(x), db2linear(x) | linear_to_db(x), db_to_linear(x) |
str2var(s), var2str(v) | str_to_var(s), var_to_str(v) |
bytes2var(b), var2bytes(v) | bytes_to_var(b), var_to_bytes(v) |
dict2inst(d), inst2dict(o) | dict_to_inst(d), inst_to_dict(o) |
funcref(obj, "name") | Callable(obj, "name"), or just obj.name |
parse_json(text), to_json(data) | JSON.parse_string(text), JSON.stringify(data) |
is_network_master() | is_multiplayer_authority() |
set_network_master(id) | set_multiplayer_authority(id) |
find_node("Name") | find_child("Name") |
raise() | move_to_front() |
update() (CanvasItem) | queue_redraw() |
set_as_toplevel(true) | set_as_top_level(true) |
get_world() (3D nodes) | get_world_3d() |
add_color_override(...), get_stylebox(...) | add_theme_color_override(...), get_theme_stylebox(...) |
The same renames hit calls made on other objects, such as scene.instance() (now instantiate()), get_tree().change_scene(path) (now change_scene_to_file(path)) and array.empty() (now is_empty()). Those say “in base Array” or fail at runtime, as explained further down.
Some Godot 3 leftovers produce a different message, because the function still exists but changed shape. yield(...) is reported as removed in favour of await. move_and_slide(velocity) fails with Too many arguments for "move_and_slide()" call, since Godot 4 reads the velocity property. connect("pressed", self, "_on_pressed") fails on its arguments; write pressed.connect(_on_pressed). The Tween node’s interpolate_property() is replaced by create_tween().tween_property(); see tweens in Godot 4.
The “Did you mean” suggestion is controlled by Project Settings > Debug > GDScript > Renamed in Godot 4 Hint, which is on by default.
Fix 2: call it on the object that has it
A bare call always means “on this script”. To call a function that lives elsewhere, put a reference in front.
# enemy.gd, broken: take_damage() is defined in player.gd
func _on_hitbox_body_entered(body):
take_damage(10)
# fixed: call it on the node that owns it
func _on_hitbox_body_entered(body):
if body.has_method("take_damage"):
body.take_damage(10)
Other forms of the same fix: $Player.take_damage(10) for a child, get_parent().refresh() for the parent, GameState.save() for an autoload (the name is the one set under Project Settings > Globals), or an @export var player: Player filled in the Inspector. If an autoload name is not recognized, see autoload not accessible from other scripts.
Fix 3: correct the extends line or the class layout
# broken: Node has no move_and_slide()
extends Node
func _physics_process(delta):
move_and_slide()
# fixed
extends CharacterBody2D
func _physics_process(delta):
move_and_slide()
The node the script is attached to must then be a CharacterBody2D as well, or attaching fails with a message that the script inherits from a different native type.
When a base script needs a function that each child implements, declare a stub in the base so the name exists:
# weapon.gd
class_name Weapon
extends Node2D
func fire() -> void:
_spawn_projectile()
func _spawn_projectile() -> void:
pass # overridden in pistol.gd, shotgun.gd
Fix 4: move the function back to the top level
A func indented inside another function is legal GDScript: it is a lambda that happens to have a name, and nothing calls it. The script then has no member called heal().
# broken: heal is a lambda inside _ready, not a method
func _ready():
health = max_health
func heal(amount):
health += amount
func _on_potion_used():
heal(25) # Function "heal()" not found in base self.
# fixed: func at column zero
func _ready():
health = max_health
func heal(amount):
health += amount
The same happens when the function sits under an inner class Stats: block. It belongs to Stats, so you need an instance: var stats := Stats.new(), then stats.heal(25). Mixed tabs and spaces cause their own errors, covered in expected indented block.
When the base is not self
The word after “in base” tells you where Godot looked:
| Message | Meaning |
|---|---|
Function "x()" not found in base self. | Bare call or self.x(). Not in this script or its ancestors. |
Function "x()" not found in base Node2D. | super.x(), and the parent class has no x. |
Function "empty()" not found in base Array. | Called on a value whose type is known to be a built-in type (Array, String, Vector2, int). |
Static function "x()" not found in base "GDScriptNativeClass". | Called on a class name, such as Node2D.x(), and the class has no static function with that name. |
Name "x" called as a function but is a "Signal". | The name exists, but it is a signal or variable. Use x.emit() for a signal. |
Cannot call non-static function "x()" from the static function "y()". | The function exists but needs an instance, and a static func has none. |
Calls on node references are deliberately not checked this strictly, because the node may carry a script that adds the function. $Sprite2D.x() compiles and fails when it runs, with Invalid call. Nonexistent function 'x' in base 'Sprite2D', or in base 'Nil' when the node path found nothing.
If the Errors list also contains a line about a type or identifier that could not be found, fix that first. A script whose parent class or class_name failed to resolve (a disabled addon, a cyclic reference, a parse error in the base script) loses every inherited function at once; see identifier not found.
Using the project converter, and its limits
For a whole Godot 3 project, do not fix names by hand. Import the project in the Godot 4 Project Manager and choose Convert Full Project, or run the converter from a terminal on a copy of the project:
godot --headless --path /path/to/project --validate-conversion-3to4
godot --headless --path /path/to/project --convert-3to4
The first command lists what would change; the second rewrites the files. The converter is a text replacement pass over the rename table. It fixes the names in the table above and does not restructure code, so yield, signal connections with string arguments, move_and_slide arguments, tweens and TileMap calls still need manual work afterwards.
How to confirm the fix
Save the script and check that the status bar at the bottom of the script editor is clear. Then run the project and read the Errors tab of the debugger. Scripts are compiled when they are loaded, so a broken script in a scene you did not open stays hidden until that scene loads. To check every script without playing through the game, run the engine once from a terminal and look for parse errors in the output:
godot --headless --path /path/to/project --import
The --import flag exists from Godot 4.3. On older versions, open each script once or use --check-only --script path/to/file.gd per file.
Catching the scripts you did not open
Most of these never leave the editor, since the red underline is hard to miss. The ones that ship are in scripts nobody loaded before release: a rarely visited scene, a level added late, an addon updated the day before launch. On a player’s machine the script fails to load and the log records the parse error. Bugnet’s Godot SDK reads the engine’s log file and files error lines as reports with the recent log, platform, OS and game version attached, so a “Failed to load script” from the field arrives with the script path in it. This depends on File Logging being enabled, which it is not by default on mobile exports. Identical titles stack into one entry with an occurrence count. Setup is in the SDK docs.
Related guides
- How to Fix “Invalid call. Nonexistent function” in Godot
- How to Fix “Parser Error: Identifier not found” in Godot
- How to Fix “Expected indented block” Parse Errors in GDScript
- Fix: Godot Tween Not Working in Godot 4 (SceneTreeTween Migration)
- Fix: Godot Autoload/Singleton Not Accessible from Other Scripts
Frequently asked questions
What does Function not found in base self mean in Godot?
The script calls a function with no object in front of it, and Godot could not find that function in the script or in any class it extends. It is a compile-time error in Godot 4, so the script will not load until the call is fixed.
Why does deg2rad or rand_range not work in Godot 4?
They were renamed in Godot 4.0. Use deg_to_rad and rad_to_deg for the angle conversions, randf_range or randi_range for random ranges, snapped for stepify and remap for range_lerp. The editor suggests the new name next to the error.
How do I call a function from another script in Godot?
Call it through a reference to the node or object that has it, for example $Player.take_damage(10), get_parent().refresh() or an autoload name such as GameState.save(). A bare function name always refers to the current script.
Why does Godot say move_and_slide is not found in base self?
The script does not extend a class that has it. move_and_slide belongs to CharacterBody2D and CharacterBody3D, so the first line must be extends CharacterBody2D or CharacterBody3D, and the script must be attached to a node of that type.
Is there a tool to convert Godot 3 scripts to Godot 4?
Yes. The Godot 4 Project Manager offers Convert Full Project when you import a Godot 3 project, and the command line has --convert-3to4. It renames functions and properties but does not rewrite yield, signal connections or tweens.
Base self means Godot looked only in this script and its parent classes. Find where the function really lives, then either fix the name, fix the extends line or put a reference in front of the call.