Message 1 of 5
Maya 2022/3: drag/drop Python script isn't reloaded on import
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey all,
Found that executing a drag/drop Python file using the onMayaDroppedPythonFile function does not reload the module like it did in 2020. As a result, updating the script and drag/dropping it in the viewport will not run the updated version, but the cached version. I have to remove the module from sys.modules in order for drag/drop to reflect any changes. It'd be great if drag/drop automatically reloaded the module on import again. I saw this in 2022.3 and 2023 (haven't tried 2021).
Repro:
- Create a testScript.py with a onMayaDroppedPythonFile function that prints("hi").
- Drag/drop into Maya's viewport, and "hi" will print in the Script Editor.
- Modify testScript.py and replace "hi" with "bye".
- Drag/drop the testScript.py into the viewport and "hi" will print in the Script Editor. It should print "bye"