title: Calling a non-returning python function from a python script
body: <p>I want to call a wrapped C++ function from a python script which is not returning immediately (in detail: it is a function which starts a QApplication window and the last line in that function is QApplication->exec()). So after that function call I want to move on to my next line in the python script but on executing this script and the previous line it hangs forever.</p>
  
  <p>In contrast when I manually type my script line for line in the python command line I can go on to my next line after pressing enter a second time on the non-returning function call line.</p>
  
  <p>So how to solve the issue when executing the script?</p>
  
  <p>Thanks!!</p>
  
  <p>Edit:</p>
  
  <p>My python interpreter is embedded in an application. I want to write an extension for this application as a separate Qt4 window. All the python stuff is only for make my graphical plugin accessible per script (per boost.python wrapping).</p>
  
  <p>My python script:</p>
  
  <pre><code>import imp
  import os
  Plugin = imp.load_dynamic('Plugin', os.getcwd() + 'Plugin.dll')
  
  qt = Plugin.StartQt4()     # it hangs here when executing as script
  pl = PluginCPP.PluginCPP() # Creates a QMainWindow
  pl.ShowWindow()            # shows the window
  </code></pre>
  
  <p>The C++ code for the Qt start function looks like this:</p>
  
  <pre><code>class StartQt4
  {
  public:
    StartQt4()
    {
      int i = 0;
      QApplication* qapp = new QApplication(i, NULL);
      qapp-&gt;exec();
    }
  };
  </code></pre>