Search code examples
pythonpython-3.6pyside2

Can I run an PySide2 application as a Windows Background Process


I want that the app accept an input from the user and then go into the background as a Windows Background Process. So, is that even possible? If yes then how?

I am using Python 3.6.8 and the PySide2 gui framework


Solution

  • You can run an external background process with pythonw.exe. You will have to run it by using subprocess or via Qprocess in pyside.

    import subprocess
    subprocess.run(["pythonw.exe", "path/to/your/program"])
    
    

    This will run your program in the background with no visible process or way to interact with it. You can only terminate it with a system monitor