Solved by ptrblck in post #2 
              
              
                Windows needs this if-clause protection, since it’s using spawn for multiprocessing. 
If you don’t protect your code, the script will be called multiple times executing all module-level code, thus yielding an error. 
Have a look at the Windows FAQ for further information.