How to execute publish and subscribe in separate files?

59 views
Skip to first unread message

Spencer Du

unread,
Sep 5, 2019, 5:15:31 PM9/5/19
to MQTT
Hi

I have two files gui.py and embedded.py. How do I execute and connect to a broker in both files but publish a message to a topic in GUI.py and then print out something first but wait in embedded.py and then after GUI.py has published, embedded.py then subscribes to the topic and prints out something and then repeat this process again for a different publish message. Essentially if I publish something to a topic in GUI.py, embedded.py then reacts to this by subscribing to the topic and then execute some code such as printing something etc. How do I do this?

Thanks  
Reply all
Reply to author
Forward
0 new messages