Definition and Usage
Execute Python code allows you to run a specific function defined within your Python code and retrieve its return value. This action enables you to incorporate custom Python functionality directly into your RPA workflow, passing variables from your flow as function parameters and storing the function's output for later use.
Parameter Values
Input parameters
Parameter | Description | Possible Values | Required | Options / Notes |
Python code | Write your Python code as one or more functions; only the selected function will be executed; its return value will be saved to the output variable; you can pass flow variables to the function as parameters; supported input types: string, bool, int, float, list, and dict | Custom Python code | Yes | Use 'print' for logging messages and 'return' to output values |
Function to execute | Select the function to run from your Python code | Function names defined in your code | Yes | The function must be properly defined in your Python code |
Function Arguments | Parameters to pass to the selected function | Any valid variable or value | No | Parameters must match the function's expected arguments |
Advanced settings
Parameter | Description | Possible Values | Required | Options / Notes |
Use local Python environment | Use the Python environment installed on your local machine to run the code | True/False | No | Default is False (uses built-in Python runtime) |
Environment detection method | Select how to locate your local Python environment | Auto detect, Specify path | No | Only applicable when using local Python environment |
Python installation directory | Select the directory where Python is installed on your system | Valid file path | No | Required only when "Specify path" is selected |
Error handling
Parameter Name | Description |
Throw error & stop | When an error occurs, the action will trigger an error and stop the execution of the entire app. |
Retry command | If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process. |
Ignore error & continue | When an error occurs, the action will be ignored, and the workflow will continue without interruption. |
Variables produced
This action produces an output variable containing the return value from the executed Python function. The variable name is specified in the "Store result into" field.
Using Variables in Conditions
You can use variables in the Function Arguments field by clicking the {x} icon or typing the variable name in curly braces. This allows you to pass dynamic values from your workflow into your Python function. The variables must be of a type compatible with the function's parameter requirements (string, bool, int, float, list, or dict).
Notes
The Python code must be structured as one or more properly defined functions.
Only the selected function will be executed, but your code can contain multiple functions that call each other.
The return value of your function will be automatically converted to an appropriate format for use in subsequent workflow steps.
When using the local Python environment option, ensure that any required packages are already installed in that environment.
For complex data processing or integration with external systems, consider structuring your code into multiple functions with clear inputs and outputs.
The execution environment has limited access to system resources for security reasons.