How to Integrate Python with UiPath

Integrating python with UiPath is that hard?

No, it is quite easy to achieve this task. In this article, we will see how to do that.

First things first in order to integrate python with UiPath you need to have python installed on your local machine.

First we will see which version to install.

For me, python 3.6 is working fine with UiPath. So, I recommend you to use python 3.6 instead of going for higher versions.

If you don’t have python installed, click the link below it will download an executable file which is python 3.6.

Click here to download python

Now you have python installed on your local machine and I assume UiPath is already installed.

So, lets jump into the integration of python with UiPath part now.

The first thing you need to do is go to manage packages in UiPath Studio and install the python package as shown below.

UiPath

After installing the python package then you are able to see python activities in the Activities panel of UiPath Studio.

Firstly, we need Python Scope in order to initialize python to execute the code.

Now we will discuss the properties that need to be verified in Python Scope.

Activity Name: Python Scope

PythonUiPath

Here :

  • Path – you need to specify the installed path of your python.
  • Target – specify the python runtime platform.
  • Version – As we are using Python 3.6 version select Python_36 as shown above.
  • Working Folder – This specifies the working folder of the scripts executing under the current scope.

After Python Scope we need to load the python script.

Activity Name: Load Python Script

PythonUiPath

Here:

  • Code – If you have the python code then enter it here.
  • File – If you have the python file then provide the path.
  • Result – This will be the output of load python script activity which is a python object.

The next step is to use that python object in next activity.

Activity Name: Invoke Python Method

PythonUiPath

Here:

  • InputParameters – Provide the input parameters If your python script has input parameters.
  • Instance – you need to pass the output of load python script activity.
  • Name – Here enter the method name that is used in the python script.
  • Result – This is the output of Invoke python method activity which is a python object.

After this we need the get the output value of python script.

Activity Name: Get Python Object

PythonUiPath

Here:

  • PythonObject – enter the python object from which it needs to get the value ie., the result of Invoke Python Method.
  • Result – This will give you the output of your python script.

The output of this is as below:

PythonUiPath

Now let us see the python script that is used in this example.

import os
def add():
        result= 1+2
        return result

The above is the python code that is used to add two values by integrating python with UiPath.

Now let’s see the whole workflow after doing all this is as below:

PythonUiPath

Happy Learning!

Like this post then let your friends know about this-:

2 thoughts on “How to Integrate Python with UiPath

Leave a Reply

Your email address will not be published. Required fields are marked *