Renamed scripts directory and now Godot... oh god, no! LOL?

I sometimes get the same parse error after renaming or moving script files. It feels like it doesn’t happen that often anymore in 4.2.2 but whenever it happens, I fix it like this:

  1. Change class_name to some temporary class_name (“MyClass” → “MyClass1”)
  2. Save the script
  3. Change class_name back to the original name (“MyClass1” → “MyClass”)
  4. Save the script
  5. Restart Godot