How to make Python Wait for input?
<p>I am using python in Maya, a 3D animation package. I would loved to run a definition (A) but within that definition I want another definiton (B) that requires a valid object selection. The script will kept going until one is made (in def B) and I want to continue with my script (def A) with a returned value from def B. How can I tell def A to wait until a valid returned value is retreived from def B?</p>

<p>So short question: How can I make python wait for a valid returned value to be received?</p>

<p>I hope that make sense and thank you in advance for your time.</p>

<p>C</p>

<p>example:</p>

<pre><code>def commandA () :
   result = commandB()
   ### Wait for a value here ###
   if result == "OMG its a valid selection" :
      do_another_commandC()

def commandB () :
   # This command is kept running until a desired type of selection is made
   maya.mel.eval("scriptjob \"making a valid selection\" -type polygon")
   if selection == "polygon" :
      return "OMG its a valid selection"
   else :
      commandB()
</code></pre>

<p>I need some thing in ### line for the function to wait until a desired return is received, then continue on with the rest. At the moment the function just run everything regardless.</p>

<p>Thank you</p>
