EditorInferface class not available on exported games

Godot Version

4.6.stable

Question

So I have a small issue with a plugin I’m developing (Terration) - the plugin automatically updates node names based on their property configuration, and it does this by using the Inspector’s property_edited signal.

I’m accessing the Inspector with the EditorInterface.get_inspector() function, which works just fine, until I export the game (the exported game can’t parse the script, as it’s throwing an error saying the EditorInterface class doesn’t exist).

I’m assuming Godot simply doesn’t include the EditorInterface class on export, so I’m a bit stuck on how to solve this problem.

NOTE: I’m already only making the signal connection if Engine.is_editor_hint(), but this isn’t really a big deal since the script can’t even be parsed

Anyways, if anyone has any ideas on how I could solve this, that would be great!
My initial thought is to just access the class via string name or something, but I’ve never done this in GDScript / not sure if it’s even possible :stuck_out_tongue:

FIXED!

I ended up using the get_singleton() function instead like so:

func _ready() -> void:
	if Engine.is_editor_hint():
		var ei = Engine.get_singleton("EditorInterface")
		if ei:
			var inspector = ei.get_inspector()
			inspector.property_edited.connect(update_name.unbind(1))

The only issue is that it’s not really possible to statically type the EditorInterface or EditorInspector classes anymore.