Python 3 function node and global variables


#1

I'm experimenting with the python 3 function node - trying to to pass global variables between two functions. There is no global.set() or global.get() exact equivalent in python. Just wondering what syntax could be try.


#2

For various reasons, I would like to recommend you to run the python code outside of Node-RED and communicate between them using MQTT. In this way you can still access variables in NR and have the benefit that your python code runs in one or more separate threads


#3

Thanks for what I'm sure is good advice. The python function nodes may not be ready for prime time. I have been a little apprehensive of writing functions in JS since I don't have a lot of experience with the language. But, there are plenty of examples for node-red and I'm sure if work on my curly brace anxiety I'll get the hang of this soon.


#4

More on... Python Global Variable