'got an error while running a simple multithreading code

I did a research but the only thing I saw was the if __name__ == '__main__' thing, which didn't help. can you help me spot the problem?

here's the code:

import multiprocessing
from multiprocessing import *
manager = Manager()
sharedVar = manager.Value()
sharedVar.value = 0


def worker():
    sharedVar.value = 1432


if __name__ == '__main__':
    process1 = multiprocessing.Process(target=worker)

    process1.start()
    process1.join()

    print(sharedVar)

and the error:

raise RuntimeError('''
RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

Process finished with exit code -1


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source