title: Creating a simple hierarchy structure in Maya using mel/python
body: <p>So I want to create a very simple structure out of group and locator nodes in Maya which will then be exported for use in my game level.</p>
  
  <p>e.g. </p>
  
  <pre><code>Group_Root
    group_parent
      - group1
        - locator1
      - group2
        - locator2
      - group3
  </code></pre>
  
  <p>There is only one Group_Root in the file, there are many group_parents ( each uniquely named )
  However all group_parent's have the same three sub-group names( "group1", "group2", "group3" ) and all group1 have a locator called locator1</p>
  
  <p>What I have so far is:</p>
  
  <pre><code>group_parent = c.group( em=True, name="group_parent", parent="Group_Root")
  modes =  ["group1", "group2", "group3"]
  for mode in modes:
      mode_group = c.group( em=True, n=mode, parent=group_parent )
      if mode == "group1":
              s = c.spaceLocator(name="locator1")
              c.parent( mode_group ) 
      elif mode == "group3":
              s = c.spaceLocator(name="locator2")
              c.parent( mode_group )
  </code></pre>
  
  <p>However I get this error at "c.parent(mode_group)"</p>
  
  <p># Error: Object group1 is invalid</p>
  
  <p>Presumably because there are more than one node called "group1" so it doesn't know which one to parent.</p>
  
  <p>Any idea how I do this with full paths? e.g. "Group_Root|group_parent|group1"</p>