set() is not working in my @tool script

Godot Version

4.7.1

Question

I’m following a tutorial for the engine. The tutorial had me create a scene—let’s call it item.tscn—that has a configurable variable, for the length of a line that is a child node of item.tscn. The line’s points are set in the inspector to two points, each with the position (0, 0). To see the results of this configuration in real time, I was told to use set(). When the variable’s value is changed, the code should lengthen/shorten the line.

Now, this works fine in the map scene.

However, in item.tscn itself, the line’s length does not update! set() isn’t even called at all! Why isn’t set() called in item.tscn, yet is called in the map scene?

@tool
...

@export_range(12, 400) var length := 32 :
	set(new_length):
		print("Blarg")
		length = new_length
		...

# In item.tscn: prints "Set length"
# In map scene: prints "Blarg\nSet length"

P.S. Setting the second point’s x value manually works, meaning the line didn’t somehow cease to exist.

I am a bit confused. What you wanna do?

If another script is involved, it has to be @tool too.

set() should actually run.

Why would there be another script involved in the item’s scene, but not in the map scene?

How would I know why?

You need to provide more context.

I don’t know what other context would help—nothing else seems related to the problem.

I just tried printing something using _process() in the tool script, to find that the script is not running at all in the item’s own scene (works fine in the map scene though).

Well . . . I restarted the editor and it’s fine now.