Skip to main content

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​

InputTypeRequiredDefaultWhat it is
FileFileNoPython file (.py) that defines the function.
FunctionStringYesFunction name; use Class.method for a static method.
ArgumentsListNoPositional arguments, in order.
Keyword argumentsDictionaryNoNamed arguments.
Timeout (seconds)NumberNo300Maximum run time.
Fail on errorBooleanNotrueFail the step when the function raises an error; when false the error is returned in error and the step continues.
InterpreterStringNoPython program to use; found on the PATH when empty.
EnvironmentDictionaryNoExtra environment variables for Python.
ScriptStringNoCode that defines the function, typed in the agent, instead of a file.

Outputs​

OutputTypeWhat it is
resultAnyValue returned by the function (numbers, text, lists and dictionaries).
outputStringText the function printed.
errorStringError raised by the function when fail_on_error is false; empty on success.