I have written a script that will keep itself up to date by downloading the latest version from a website and overwriting the running script.
I am not sure what the
To additionally support script calls with Python's "-m" parameter the following can be used (based on the Alex's answer; Windows version):
os.spawnl(os.P_WAIT, sys.executable, *([sys.executable] + (sys.argv if __package__ is None else ["-m", __loader__.name] + sys.argv[1:]))) sys.exit()