def F(path): "separate file objects + forking" with lockpath.keeping(path): if os.fork(): os.wait() else: lockpath(path)