title: Child thread freezes until script ends when calling mutagen function, no errors
body: <p>So I'm working on a music player in python and when I init the main window it starts a thread that is supposed to get the metadata from files. But instead it just stops at the first import call in mutagens File function.</p>
  
  <p>When I'm executing the script directly with python.exe it works without problems. But when I use the native python api in c++ to start the script, the thread that calls the function, freezes. However, I'm able to call the function from the main thread without problems.</p>
  
  <p>main.cpp:</p>
  
  <pre><code>_putenv_s("PYTHONPATH", "python32.zip");
  
  Py_Initialize();
  PyRun_SimpleString("import cmw");
  Py_Finalize();
  </code></pre>
  
  <p>cmw.py:</p>
  
  <pre><code>import meta
  class MW(QtGui.QMainWindow):
      def __init__(self):
      super().__init__(None)
      ... 
      self.m = meta.Meta()
      self.m.get(lists_of_files)
  </code></pre>
  
  <p>meta.py:</p>
  
  <pre><code>import mutagen
  class Meta:
      def __init__(self):
          self.q = Queue()
          self.lock = Lock()
          self.result = []
  
      def get(self, files):
          t = Thread(target=self._work)
          t.daemon = True
          t.start()
  
          for f in files:
               self.q.put(f)
  
      def _work(self):
          while True:
              f = self.q.get()
              print(1)
              meta = mutagen.File(f)
              with self.lock:
                  self.result.append(meta)
              self.q.task_done()
              print("Done")
  </code></pre>
  
  <p>Mutagens <strong>init</strong>.py:</p>
  
  <pre><code>def File(filename, options=None, easy=False):
  
     print(2)
     if options is None:
         from mutagen.asf import ASF
         ... imports lots of files ...
  
     print(5)
  </code></pre>
  
  <p>Mutagens asf.py:</p>
  
  <pre><code>print(3)
  ... All the code ...
  print(4)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>1
  2
  </code></pre>
  
  <p>The rest of the program works just fine. No exceptions no nothing. And when the script exits</p>
  
  <pre><code>3
  4
  5
  </code></pre>
  
  <p>EDIT:Fixed it by changing import to exec(open().read()) in main.cpp.</p>