I am currently working on an Raspyberry Pi Camera project where I am using an Adafruit Neopixel ring as a ringlight. The Neopixle library needs the script to be run with sudo in order to work, but I don't really want to have to run the entire project as sudo, for one because I know sudo should only be used as much as necessary and 3 out of 300+ lines hardy seem enough to justify it. And on the other hand, the project also writes a couple of paramters to a json as a save file and all these saves needing superuser permission to edit is making testing very tedious...
I had already isolated the code needing to be run with sudo into a function ringlight()
which I transfererd to it's own file, ringlight.py.
From my main project, I now turn on my ringlight with os.system("sudo python ringlight.py")
But how can I close the instance of ringlight.py from my main project without closing it to?
I already tried putting if input() == 'q': raise SystemExit
in my ringlight.py and then sending os.system("q")
from the main script but without the desired effect.