title: (Maya Python) How do I run radio option buttons through a GUI function?
body: <p>Normally when I run a script with radio button options you select a radio button option and then you activate it with the button. I used to leave my menu gui outside of a function: but ever since I learned importing maya scripts I started wrapping my menu interfaces in a GUI function which mean my radio button technique now no longer works. I have no idea how to get it to work either. The script itself is simple enough: just select a radio button option after importing the script and then create a shape with the button: atleast thats how it SHOULD work. Instead I get no errors and no shapes created and I dont know whats broken.</p>
  
  <pre><code>'''
  import cubeTestTemp
  reload (cubeTestTemp)
  cubeTestTemp.gui()
  '''
  
  import maya.cmds as cmds
  
  #Creates ui. 
  if cmds.window("cubeWin", exists =True):
      cmds.deleteUI("cubeWin", window = True)
  
  myWindow = cmds.window("cubeWin",t='DS shapeDemo V1',w=200, h=500, toolbox=True)
  column = cmds.columnLayout(adj=True)
  #Creates variable to indicate the check box status. 1=Checked 0=Not Checked. 
  
  cubeNum1 = 0
  cubeNum2 = 0
  
  
  #Creates Button funtion. 
  def defaultButtonPush(*args):
         #The Print checks if button is pushed and what is the check box status. 
         print "Button is pushed."
         print cubeNum1
         #Check box argument finds the status of the variable and determines what to do. 
         #Eather create a cube or display a error dialog box.
         if cubeNum1 == 1:
          print "Cube Creation sucessful"
          cmds.polyCube()
  
         print "Button is pushed."
         print cubeNum2
         if cubeNum2 == 1:
          print "Sphere Creation sucessful"
          cmds.polySphere()
  
  
  def gui(*args):
      #Creates check box. 
      #In the onCommand Script (onc) and offCommand Script (ofc) flags all commands must be made in between double quotes.
      cmds.radioCollection()
      cmds.radioButton(label='Cube',align='left',onCommand="cubeNum1 = 1", offCommand="cubeNum1 = 0")
      cmds.radioButton(label='Sphere',align='left',onCommand="cubeNum2 = 1", offCommand="cubeNum2 = 0")
      #Creates Button.
      cmds.button( label='Execute', command=defaultButtonPush ,align='left' )
  
  cmds.showWindow()
  </code></pre>