I have a python script to control some LEDS. In a compiled c++ program I have been calling python scripts like so in various places:
system("python /home/pi/leds_flash.py") system("python /home/pi/leds_sleep.py)
Each of those function controls led lights accordingly and
exits(). It's working great, but I really need my python script to keep state.
I am assuming that the best way to set things up is to create an instance of an LED controller script that remains running in the background on which I could invoke functions or send messages.
I've briefly been looking into how to run a script as a service, but still unsure how to invoke functions on this service or if this is even the best way to accomplish what I am after.
I'm a newb to raspberry pi and python so appreciate any guidance on this.