Post #5597: execute_script() fundamentally returns True by specification, so it cannot b
๐ Metadata
- Author: Pluglug
- Date: 2025-09-17 07:36:39
- Type:
answer - Quality Score: 8/10
- Reply to: post_05596
- Replies (1): post_05598
๐ท๏ธ Tags
python-scripting intermediate solved
โ๏ธ Related PME Features
- Python Scripting
- Macro Editor
๐ฌ Content
execute_script() fundamentally returns True by specification, so it cannot be used as a function object, which is why the error occurs.
When passing arguments to a script, they should be passed as kwargs to execute_script().
# command tab
execute_script("greeting.py", msg="Hello")
# scripts/greeting.py
def say_hello(msg):
print(msg)
say_hello(kwargs["msg"])
When you want to get a return value from a script, store it in a variable called return_value.
# command tab
msg = execute_script("hi.py"); print(msg)
# scripts/hi.py
return_value = "Hi!"
If this explanation doesnโt clarify things for you, please share the scripts youโre using and details about your setup.