title: How to run command on multiple selected objects in maya
body: <p>I'm sure this is a total noob question. I'm in Maya and I need to select a whole bunch of objects, then create a joint that is parented under each of those objects. </p>
  
  <p>It works perfectly on a single selected object using this code:</p>
  
  <pre><code>import maya.cmds as mc
  selection = mc.ls(sl=True)
  for all in selection:
      mc.joint()
  </code></pre>
  
  <p>But it fails when I have more than 1 object selected. How can I get my for loop to work on each selected object?</p>
  
  <p>Thanks</p>