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:
- Change class_name to some temporary class_name (“MyClass” → “MyClass1”)
- Save the script
- Change class_name back to the original name (“MyClass1” → “MyClass”)
- Save the script
- Restart Godot