I'm looking to run a python script that calls commands through subprocess depending on various arguments that are given to it. For ease of use it would be valuable to be able to use it as an executable that is run from cmd. I'm wondering if it's possible to convert from .py to .exe, run the program from cmd using "mypycode.exe args1 args2", and then to have that run in the background and be able to close cmd while it continues to run?
Using subprocess.DEVNULL I was able to stop the process from opening new cmd windows whenever the code looped however if I close out of the cmd window the program exits.
I've also looked at using Popen from subprocess however it seems that it might remove the ability to convert to .exe and possibly the ability to pass args unless I'm understanding it incorrectly.
I've also tried simply using pyinstaller using the -w flag to run the process without a cmd window popup however this crashes the program and gives an error "Failed to execute script mypycode".
I'm looking to be able to call the .exe from a cmd and essentially start the process and allow me to continue using cmd or close it and have the process continue in the background.
So far I either can't use cmd after calling mypycode.exe and also kill the process when cmd is closed, or I get the previously mentioned error that it failed to execute.