37

I have been trying to code a python script which reads data from a serial port. It worked well from the command line but I need it to run as a background process without any command line interface. The script has a while loop which reads the next byte of data from a serial port and simulates a key press accordingly. For the keypresses to be focused on the current window, instead of python command line, I need the script to run as a background process. I have read few answers here but nothing rang a bell for me. Please point me in the right direction.

1
  • pythonw my_script.py Commented Oct 25, 2024 at 14:36

1 Answer 1

90

On Windows, you can run a Python script in the background using the pythonw.exe executable, which will run your program with no visible process or way to interact with it. You also cannot terminate it without a system monitor. More information on pythonw.exe can be found in the answers to the question: pythonw.exe or python.exe?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.