The "tool" keyword was removed in Godot 4: use @tool

By Eduardo Orellana · Updated

Put @tool on the first line instead of tool. In Godot 4 a script that runs in the editor starts with @tool, and the check for the editor is the method Engine.is_editor_hint(), no longer the property Engine.editor_hint.

AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.

Intel or AMD Chromebook, with Linux turned on.

Download for macOSDownload for Windows

What Godot is checking

GDScript 2.0 turned tool, export and onready into annotations. The parser recognises the old tool keyword so it can name the replacement, and stops: the script does not load.

@tool makes the script run inside the editor as well as in the game. Code that should run only in one of them checks Engine.is_editor_hint(), which the fixed run prints: false, because it ran as a game.

Reproduce it

A Godot 3 tool script in a Godot 4 project. The scene is one Node with this script.

tool
extends Node

func _ready():
	print(Engine.editor_hint)

What Godot 4.7.2 prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Parse Error: The "tool" keyword was removed in Godot 4. Use the "@tool" annotation instead.
   at: GDScript::reload (res://answers/tool-keyword-removed-in-godot-4/repro.gd:1)
ERROR: Failed to load script "res://answers/tool-keyword-removed-in-godot-4/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

The annotation on the first line, and the editor check as a method call.

@tool
extends Node

func _ready() -> void:
	print("running in the editor: ", Engine.is_editor_hint())

What the fixed script prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

running in the editor: false

Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 6 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: [gdscript_parser.cpp line 1199, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L1199), [Engine.is_editor_hint in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Engine.xml#L231).

Questions

Does the order of @tool and extends matter?
@tool goes before extends at the top of the file, as in the fixed script, alongside class_name and @icon.