How do I use the "tool"? "control+shift+x". I got an error.

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

I got this message when I was trying to run a script in the editor.

modules/gdscript/gdscript.cpp:576 - Condition "!p_keep_state && has_instances" is true. Returned: ERR_ALREADY_IN_USE

This is the script that I’m trying to run, just for example, to understand how it works for further use

tool
extends Button
func _ready():
    print("Hello")

When I reload the scene, the script works. And when I use the "EditorScript" extension and the "tool" keyword also works. But I need the above code to work when I press “control + shift + x”.

In the documentation there is that when I “run the script in the editor, it runs” but it does not work for me, the editor is fine.

What am I doing wrong?