Skip to content

[4.3] Hot reload of @tool scripts stops working after first reload #97280

Description

@dmlary

Tested versions

  • Reproduces in v4.3.stable.official [77dcf97]
  • Fixed in v4.4.dev.custom_build [621cadc] (confirmed fixed in this commit; prior commit still has issue)

System information

Godot v4.3.stable - macOS 14.6.1 - Vulkan (Forward+) - integrated Apple M3 Max - Apple M3 Max (16 Threads)

Issue description

@tool scripts do not hot reload after the first hot reload when using an external editor. During the first hot reload the following error is generated:

modules/gdscript/gdscript.cpp:745 - Condition "!p_keep_state && has_instances" is true. Returning: ERR_ALREADY_IN_USE

Note this is not the same issue as #97238 which is 4.4 specific.

Steps to reproduce

  • Create a new project

  • Add a Node3D

  • Attach a script to that Node3D

  • Make script a @tool script, and add a print to the _ready() function; save it

  • Switch back to godot editor

  • Save & reopen scene in editor (seems to be necessary on macos right now)

  • Confirm print from _ready()

  • Edit script to change print message; save script

  • Switch back to godot editor

  • Godot will display the ERR_ALREADY_IN_USE error

  • Close and reopen scene and updated _ready() message will be printed

  • Edit script, changing the print message again: save script

  • Switch back to godot editor

  • Godot will not print any new message

  • close & reopens scene and the message from the previous edit will be shown

Screenshot 2024-09-21 at 8 12 06 AM

Minimal reproduction project (MRP)

hot-reload-issue.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    For team assessment

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions