title: Creating a Maya UI
body: <p>I am creating a maya UI but when I try to run my loadobject button command twice after I run my replace_name button once in maya I get this error:</p>
  
  <pre><code>cmds.textFieldButtonGrp(self.loadobject, e=True, text=select_objects[0])
  RuntimeError:
  </code></pre>
  
  <p>Hope someone could help me fix this.
  Thanks.</p>
  
  <pre><code>import maya.cmds as cmds
  
  
  class MyUI:
      def __init__(self):
          self.title = "Test UI"
          self.window = cmds.window(self.title, widthHeight=(1000, 600),
                           resizeToFitChildren=1)
  
          cmds.rowLayout("button1, button2, button3", numberOfColumns=5)
  
          cmds.columnLayout(adjustableColumn=True, columnAlign="center",
                        rowSpacing=10)
          self.loadobject = cmds.textFieldButtonGrp(label="Load Object name",
                                                    buttonLabel="Load",
                                                    text="Select Object %s."
                                                    % "and Load name",
                                                    buttonCommand=self.load)
          self.basename = cmds.textFieldButtonGrp(label="Basename",
                                                  buttonLabel="Rename",
                                                  text="Enter basename.",
                                                  buttonCommand=self.replace_name)
          cmds.setParent(menu=True)
  
          cmds.showWindow(self.window)
  
      def load(self, *args):
          select_objects = cmds.ls(selection=True)
          cmds.textFieldButtonGrp(self.loadobject, e=True, text=select_objects[0])
  
  
      def replace_name(self, *args):
          self.loadobject = cmds.textFieldButtonGrp(self.loadobject,
                                                 q=True, text=True)
          self.basename = cmds.textFieldButtonGrp(self.basename,
                                               q=True, text=True)
          name = cmds.rename(self.loadobject, self.basename)
          ctlname = "%s_ctl" % name
          self.new_name = cmds.rename(name, ctlname)
  </code></pre>