Mutex
This library provides a simple way to manage a mutex file for a single script to ensure that that only one instance of the script is running at any moment
Install
pip install simplemutex
Example
import scriptmutex
mylock = scriptmutex.Mutex()
def main():
mylock.create_lock()
print("Hello World")
mylock.release_lock()
if __name__ == "__main__":
if not mylock.already_running():
main()