How to send output of one python script to another in Node-RED?

Sorry if this is too trivial. I have the following proof-of-concept scenario:

Both scripts run continuously. Script 1:

while True:
    print("Hello ")

Script 2:

while True:
    print("World")

The script 2 will only print if it gets an input from script 1. I was looking at daemon and exec nodes, but got confused.

It seems a complicated way of printing Hello World so I guess you have simplified things somewhat.

Can't you use just one script, or call script2 directly from script1?
If the scripts are running continuously, the exec node is the wrong approach since it will attempt to start another instance of the script.

With a situation like this, on Linux, I would set up the script[s] as systemd jobs and pass data to and from Node-red by MQTT.

It seems a complicated way of printing Hello World so I guess you have simplified things somewhat.

Yes, that is just a proof of concept.

would set up the script[s] as systemd jobs and pass data to and from Node-red by MQTT.

I appreciate if you can provide a MWE for this.

The magic search words are probably "python paho mqtt callback".

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