# Sending Node-Red Injection Value to Variable in a Python File on my Computer

**URL:** <https://discourse.nodered.org/t/sending-node-red-injection-value-to-variable-in-a-python-file-on-my-computer/65050>\
**Category:** General\
**Created:** [13 July 2022 12:55 UTC](https://discourse.nodered.org/t/sending-node-red-injection-value-to-variable-in-a-python-file-on-my-computer/65050 "2022-07-13T12:55:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ukhan](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@ukhan](https://discourse.nodered.org/u/ukhan)\
**Post date:** [13 July 2022 12:55 UTC](https://discourse.nodered.org/t/sending-node-red-injection-value-to-variable-in-a-python-file-on-my-computer/65050/1 "2022-07-13T12:55:23Z")

</div>

Hi! I'm trying to send the value of an injection to a variable that I defined in a python file stored locally on my computer so I can use the value in my program, but I'm unsure on how to go about doing this. Any help is appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 July 2022 13:37 UTC](https://discourse.nodered.org/t/sending-node-red-injection-value-to-variable-in-a-python-file-on-my-computer/65050/2 "2022-07-13T13:37:42Z")

</div>

How are you running the python progran via an `exec` node?  
One way you could do it - if the python progran is already runing - would to add MQTT to the python progran and send the data that way.

If you are having NR start the progran, you can use the `exec` bode to start it and send the value with the command like you would if you were running the python program in a terminal session and passing it a parameter.

---

<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:** [11 September 2022 13:38 UTC](https://discourse.nodered.org/t/sending-node-red-injection-value-to-variable-in-a-python-file-on-my-computer/65050/3 "2022-09-11T13:38:26Z")

</div>

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