How do I use Invoke Python acitivities

WIth the release of a new version of UiPath, python support has been added. Could anyone please give me some working examples of how I can invoke a python function, method or something to my project?

Unfortunately the description of the methods on the official UiPath website doesn’t really make it clear to me how to use it.

For instance, I need to run a very simple python code where I have some input variables and maybe some output. What activity do I use for it?

Another question: what if my python code contains an imported library, can it be invoked to UiPath as well?

1 Like

Please check this - https://activities.uipath.com/docs/invoke-method

1 Like

Please check this sample workflow (it assumes that Python 3.6 is installed at “C:\Python36”): PythonActivitiesTest.zip (2.5 KB)

After loading the script with the Load Python Script activity, you can call a method in a script using Invoke Python Method’s input property called Input parameters.
Invoke Python Method returns a PythonObject that can be passed to the the Get Python Object activity for conversion into a .NET object.

3 Likes

Thank you, I’ll take a look at this

Hi,

are u using Python36 32 bit?
Thanks!

Hai @MGMKLML

Find the link you will get an idea.,

Regards,
D.Aravind

How do I correctly check the version of python?

Thank you, I’ll have a look :slight_smile:

Yes, currently it needs to be 32bits:

The Python Activities Pack works only with 32-bit Python scripts.

1 Like

How do I install the 32-Python, could you please hint me? I’m not very good at Python

Go to Python Releases for Windows | Python.org and download “Windows x86 executable installer”. After that, just run the installer like any other software.

@Mateus_Cruz, Okay thank you

1 Like

Excuse me, has the second problem been solved?

If you mean this problem “Another question: what if my python code contains an imported library, can it be invoked to UiPath as well?”

then yes, the python will run exactly as if you ran it from the command line so imports work fine.