I am currently building a raspberry pi project to monitor the surrounding temperature and buzz if it’s too high. The program is simple it reads the config (temp to buzz at) from a file and it uses it for the infinite while loop. I was thinking of making a separate program for a flask server to act as a GUI and the user can change the config value. I thought of making a endpoint e.g. /update so I can send the new data to it and the flask server will write it into the config file.
The problem is that I am unsure how can I make the program that is reading the temperature and in the infinite loop take in the new config value. I was thinking of simply using code and restart the program so that it can re-read the config file with the new value and run again but I am unsure if there is a better solution. Any ideas?