Using the spawn
or forkserver
start method without importing the main module might lead to unexpected behavior (for example, it might cause a RuntimeError
). Consider using if __name__ == '__main__'
to safely import the main module and then run the function.