# Pass arguman to exec node to run python script

**URL:** <https://discourse.nodered.org/t/pass-arguman-to-exec-node-to-run-python-script/73296>\
**Category:** General\
**Created:** [6 January 2023 13:30 UTC](https://discourse.nodered.org/t/pass-arguman-to-exec-node-to-run-python-script/73296 "2023-01-06T13:30:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miladmrm](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@miladmrm](https://discourse.nodered.org/u/miladmrm)\
**Post date:** [6 January 2023 13:30 UTC](https://discourse.nodered.org/t/pass-arguman-to-exec-node-to-run-python-script/73296/1 "2023-01-06T13:30:25Z")

</div>

How I can pass input as input arguments to python script run command in exec node with msg.payload?  
for exampe I want run python script with this command:  
/usr/bin/python3 test.py 1 2

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 January 2023 13:46 UTC](https://discourse.nodered.org/t/pass-arguman-to-exec-node-to-run-python-script/73296/2 "2023-01-06T13:46:18Z")

</div>

The Exec node has an option to add msg.payload to the command, so if you arrange for msg.payload to contain the string "1 2" then that will get added to the command. Often the easiest way to build the payload with the parameters is to use a template node, though that depends on how the data are available.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 March 2023 13:46 UTC](https://discourse.nodered.org/t/pass-arguman-to-exec-node-to-run-python-script/73296/3 "2023-03-07T13:46:38Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
