1import multiprocessing
2
3multiprocessing.Lock()
4
5
6def f():
7    print("ok")
8
9
10if __name__ == "__main__":
11    ctx = multiprocessing.get_context("forkserver")
12    modname = "test.mp_preload"
13    # Make sure it's importable
14    __import__(modname)
15    ctx.set_forkserver_preload([modname])
16    proc = ctx.Process(target=f)
17    proc.start()
18    proc.join()
19