diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 8b133961ae..a780be48c3 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1095,7 +1095,9 @@ void GDScript::set_path(const String &p_path, bool p_take_over) { String old_path = path; path = p_path; path_valid = true; - GDScriptCache::move_script(old_path, p_path); + if (is_root_script()) { + GDScriptCache::move_script(old_path, p_path); + } for (KeyValue> &kv : subclasses) { kv.value->set_path(p_path, p_take_over);