Argument passing in python script


In your Python script, define a function that accepts three arguments, which could be two strings and one Python object.
For example:

def my_function(arg1, arg2, arg3):
# Your Python code here

In UiPath

  • Add the Invoke Python Method activity to your workflow.
  • In the activity’s properties, set the CodeFilePath to the path of your Python script.
  • In the MethodName property, enter the name of the Python function (e.g., “my_function”).
  • In the InputParameters property, you can pass your arguments as an Object[] array. For example:

csharpCopy code

Object[] inputParameters = new Object[] { "Hello", "World", somePythonObject };

Here, "Hello" and "World" are the two string arguments, and somePythonObject is your Python object.

  1. In your Python code, you can access these arguments as you would in a regular Python function, like arg1, arg2, and arg3.

You can refer these threads for more ideas and example

Cheers @devanshi