# Python code invoke

**URL:** <https://forum.uipath.com/t/python-code-invoke/499683>\
**Category:** Robot\
**Tags:** question, robot, python, uiautomation, activities\
**Created:** [December 16, 2022, 10:02am UTC](https://forum.uipath.com/t/python-code-invoke/499683 "2022-12-16T10:02:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kuldeep\_Pandey](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kuldeep_pandey/32/269564_2.png) [@Kuldeep\_Pandey](https://forum.uipath.com/u/Kuldeep_Pandey)\
**Post date:** [December 16, 2022, 10:02am UTC](https://forum.uipath.com/t/python-code-invoke/499683/1 "2022-12-16T10:02:14Z")

</div>

I have taken a get text and give them a variable , now i want to use python code for that variable to how i can give as input in python and pls share me the workflow

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [December 16, 2022, 10:10am UTC](https://forum.uipath.com/t/python-code-invoke/499683/2 "2022-12-16T10:10:20Z")

</div>

@Kuldeep_Pandey

Please check this

> [@Passing arguments to Python](https://forum.uipath.com/t/passing-arguments-to-python/51294/5):
>
> Depends what you mean by using sys.argv. I can call this script from the command line with an arguement or call the run() method directly from UiPath with the text argument. This is the python code: import sys def run(text): return " Hi " + text if \_\_name\_\_ == "\_\_main\_\_": run(sys.argv[1]) and this is the invoke python activity to call the script: [image] The output is as expected, “Hi Bob”: [image]

Cheers

---

<div class="post-metadata">

**Author:** ![Rahul\_Unnikrishnan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rahul_unnikrishnan/32/464046_2.png) [@Rahul\_Unnikrishnan](https://forum.uipath.com/u/Rahul_Unnikrishnan)\
**Post date:** [December 16, 2022, 5:03pm UTC](https://forum.uipath.com/t/python-code-invoke/499683/3 "2022-12-16T17:03:10Z")

</div>

Hello @Kuldeep_Pandey

Please check the below video.

[![](https://global.discourse-cdn.com/uipath/original/4X/8/f/2/8f2754f248ccc164ad10ae5632ddb6727b5aa89f.jpeg "How to Execute Python Scripts in UiPath?| UiPath Python Activities| Python Scope| Load Python Script") ](https://www.youtube.com/watch?v=ysyH37iF-8Q)

Thanks
