Run Python function
Call one function in a Python file with JSON-compatible arguments and return what it returns.
Command in the Scripts toolkit · id ooa.script/run_python_function · 9 inputs (1 required), 3 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| File | File | No | Python file (.py) that defines the function. | |
| Function | String | Yes | Function name; use Class.method for a static method. | |
| Arguments | List | No | Positional arguments, in order. | |
| Keyword arguments | Dictionary | No | Named arguments. | |
| Timeout (seconds) | Number | No | 300 | Maximum run time. |
| Fail on error | Boolean | No | true | Fail the step when the function raises an error; when false the error is returned in error and the step continues. |
| Interpreter | String | No | Python program to use; found on the PATH when empty. | |
| Environment | Dictionary | No | Extra environment variables for Python. | |
| Script | String | No | Code that defines the function, typed in the agent, instead of a file. |
Outputs
| Output | Type | What it is |
|---|---|---|
| result | Any | Value returned by the function (numbers, text, lists and dictionaries). |
| output | String | Text the function printed. |
| error | String | Error raised by the function when fail_on_error is false; empty on success. |