I implemented a theme switch feature, which restarts the application using subprocess and sends a sys variable indicating the desired theme, so that the main controller can know which styles to apply for the application components.
styles_controller.py
def switch_theme(app):
app.quit()
if (not dark_mode):
subprocess.Popen(['python', 'main.py', 'dark'])
else:
subprocess.Popen(['python', 'mainp.py', 'light'])
Currently, this implementation works as desired, but my question is, if I create an executable for the application, will this implementation work on both Windows and Linux, will it even work ? What are some better ways to do it ?