import maya.cmds as mc
#get the first thing seleted in the scene
SelectedJoints = mc.ls(sl = True)
for eachJoint in SelectedJoints:
#create a circle
controller = mc.circle(n = eachJoint.replace("jt_", "ac_"))
#group the circle
controllerGrp = mc.group(controller, n = eachJoint.replace("jt_", "ac_") + "_grp")
#match the circle to the joint
mc.matchTransform(controllerGrp,eachJoint)
#get the first thing seleted in the scene
SelectedJoints = mc.ls(sl = True)
for eachJoint in SelectedJoints:
#create a circle
controller = mc.circle(n = eachJoint.replace("jt_", "ac_"))
#group the circle
controllerGrp = mc.group(controller, n = eachJoint.replace("jt_", "ac_") + "_grp")
#match the circle to the joint
mc.matchTransform(controllerGrp,eachJoint)