Tool Script throwing ERR_ALREADY_IN_USE when run

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

Im trying to make a tool script to add trimesh collision to multiple meshes in a scene but when i run the script i get an arror

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

here is my code

extends Node

func _ready():
	if Engine.editor_hint:
		for child in get_children():
			if child is MeshInstance:
:bust_in_silhouette: Reply From: Inces

Tool scripts are designed to be used in the editor, not in running project. It is pointless to code anything in readyfunction of tool script, as its line is never reached in editor. Tools are mostly usable with some connected childed buttons or setget boolean flags, and this is where any code should be : on_button_pressed or in value setter

Read about tool scripts deeply, they are actually dangerous to use when ignorant.