I’ve got some async Python3 scripts that run in the ScriptEditor, but as soon as I try to package them into a plugin, they lose the async property. Is there a way to keep the async behavior within the plugin?
It doesn’t seem like RunPythonScript sees the # async: true tag either, which means I can’t even bundle the script in the plugin shared files and create a proxy command that calls RunPythonScript.
Ideally, the scripts could just be translated to commands directly, but it seems like that behavior isn’t supported yet for some reason. Is this something that’s planned?
A really easy way to validate that this is happening is to use the following script:
"""test.py"""
#! python3
# async: true
import time
time.sleep(10)
When run in the Script Editor, it runs for 10 seconds and doesn’t block the UI thread. You can still do anything you want while it’s running, as expected. After the 10 seconds, the Script Editor registers the script as having finished running.
Attempting to run test.py via RunPythonScript locks everything up for 10 seconds, which it’s not actually running the script on a non-UI thread, as explained in Example 3 (Async).py.
Packaging test.py into a plugin and trying to run the command through the plugin has the same results as running test.py with RunPythonScript.