I am trying to create a independent, behind the scenes process which runs completely on it's own with python. Is it possible to create such a process where even after an exiting the python script the process still keeps running in the background. I have created an .exe file with pyinstaller and I want that file to run in the background without popping up a console such that the user is not aware of the process unless he tends to open his Task Manager quite often.
The multiprocessing module helps to create processes but they are terminated after the script execution is completed. Same with the threading module.
Is it by any way possible to keep some particular piece of code running in the background even after the script has finished execution? or start the whole script in the background altogether without displaying any console?
I have tried using the Process class from the multiprocessing module and the Thread class from the threading module, but all of the exit after script execution. Even the subprocess and os module proves to be of no help
from multiprocessing import Process
from threading import Thread
def bg_func():
#stuff
def main():
proc = Process(target=bg_func,args=()) #Thread alternatively
proc.start()