title: Execute Python code from within PyQt event loop
body: <p>I am testing a gui built using PyQt and I would like the ability to interact with the gui using python code that is executed after the PyQt event loop starts (<code>app.exec_())</code>. Another way of saying this is I would like the call to <code>app.exec_</code> to return immediately as if the gui were modeless, followed by further python code which interacts with the gui.</p>
  
  <p>I found <a href="http://www.sidefx.com/docs/houdini11.0/hom/cookbook/pyqt/part2/" rel="nofollow noreferrer">this</a> example of running the PyQt loop in a thread but don't want to do something so unconventional. Is there any way to get the PyQt message loop to continue processing messages while also executing python code in the main thread after <code>exec_</code> has been called?</p>