# Send variable from Node-Red to python

**URL:** <https://discourse.nodered.org/t/send-variable-from-node-red-to-python/46218>\
**Category:** General\
**Created:** [25 May 2021 12:49 UTC](https://discourse.nodered.org/t/send-variable-from-node-red-to-python/46218 "2021-05-25T12:49:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptatay](https://avatars.discourse-cdn.com/v4/letter/p/9fc29f/32.png) [@ptatay](https://discourse.nodered.org/u/ptatay)\
**Post date:** [25 May 2021 12:49 UTC](https://discourse.nodered.org/t/send-variable-from-node-red-to-python/46218/1 "2021-05-25T12:49:42Z")

</div>

Hi, I am trying to communicate python with node-red so that python knows the state of a variable that I receive by modbus.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 May 2021 14:09 UTC](https://discourse.nodered.org/t/send-variable-from-node-red-to-python/46218/2 "2021-05-25T14:09:42Z")

</div>

Hi @ptatay, welcome to the forum.

Have you searched the forum - this has been covered many many times.

It does depend on how you are running python & what you are doing but the popular recommendation is to send your values to an MQTT broker and subscribe to the topic in your python code.

---

<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:** [24 July 2021 14:10 UTC](https://discourse.nodered.org/t/send-variable-from-node-red-to-python/46218/3 "2021-07-24T14:10:18Z")

</div>

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