-1

I have a python program running in an infinite loop.

I'd like to be able:

  • To run the program in Windows Command Prompt (that is simple).
  • Keep it running in the background even if I close the cmd.
  • Reopen cmd into the (still running) program.
  • And still be able to use cmd for other commands.

Basicaly when closed it should go to the system tray and be able to be reopened, because the program sometimes requires interaction.

And would the solution be the same if I were to convert the script to exe?

I apologise if I over-complicated the question :)

Ideas / suggestions would be appreciated.

Thanks

SIR
  • 9
  • 4

2 Answers2

1

If your goal is to just hide the cmd log, I suggest you use docker. Export the code and make it run in a container within docker./

For more information, visit the docker documentation

Gevezo
  • 373
  • 2
  • 12
0

On Windows, you can run a Python script in the background using the pythonw.exe executable. This will run your program in the background, with no visible process or way to interact with it. You also cannot terminate it without a system monitor.

Belhadjer Samir
  • 1,270
  • 5
  • 14