UiPath Activities Guide

About the Python Activities Pack


The Python activity pack has been made open-source. Feel free to collaborate on our Github repositories.

The purpose of this pack is to enable you to invoke Python scripts and methods in any workflow directly from our product. You can also pass input arguments to the invoked code, as well as retrieve the output data generated by the activities.

The Python Scope container activity connects to the Python environment installed on the machine and enables you to use the rest of the activities within itself.
The PythonObject variable is specially designed to handle and manipulate Python data. By using the Load Python Script activity, you can easily assign the code from any file containing a Python script to a PythonObject and you can also convert it to a .NET data type by using the Get Python Object activity.
With this powerful variable at hand, you can run scripts, extract .NET types or invoke Python methods by using the dedicated activities for each of these tasks.

Example of Using the Python Activities Pack

To exemplify how to use this activity pack, we have built an automation process to invoke a Python script which defines two operations, Add and Subtract. One of the methods, Add, is then called from the script and given a list of integer variables as input parameters. The result, stored in a proprietary PythonObject variable, is then converted into a .NET datatype to be further used in Studio.


The Python version you want to use has to be installed on the machine you want to run the process on.

This is how the demo can be built:

  1. Open Studio and start a new Process.
  2. Drag a Python Scope activity to the Workflow Designer.
  3. Specify the installation directory of Python in the Path property of the Python Scope activity. By default, the location is %LOCALAPPDATA%\Programs\Python\PythonXX\python.exe, where XX is the Python version you are using.
  4. Drag a Load Python Script activity in the Do section of the Python Scope and add the file path to the MathOperations.py Python script in the File property.
  5. Create a new PythonObject variable, called MathFunctions and add it into the Result property field.
  6. Add an Invoke Python Method activity and configure its properties as follows:
    • Input Parameters - {2,3}
    • Instance - Add the variable created at step 5, MathFunctions, to this field.
    • Name - Add the name of the method inside the script you want to use, in this case add.
    • Result - Create a new PythonObject variable, called SumResultPython, and add it to this property field.
  7. Next, drag a Get Python Object activity to the workflow. Configure its properties as follows:
    • Python Object - Add the SumResultPython variable to this field.
    • TypeArgument - Select Int32 from the drop-down list.
    • Result - Create a new Int32 variable, called Result and add it to this field.
  8. Add a Message Box activity at the end of the project and configure it to display the Result variable.
    Your project should look like this:
  1. Run the process. The Message Box displays the result of the Add method.

You can download the project and all its additional files here.

About the Python Activities Pack

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.