Binding skin using skinCluster command
# using skinCluster command to bind smooth skin to the selected mesh with selected joints def doBindSmoothSkin(): import maya.cmds as mc; skin=False; bones=[]; # getting bones and a skin mesh sel = mc.ls(sl=1,l=1,o=1); for obj in sel: if mc.nodeType(obj)=="joint": bones.append(obj); elif mc.objExists(obj+".vtx[*]"): shapes=mc.ls(mc.listRelatives(obj,ad=0),type="mesh"); hist=mc.ls(mc.listHistory(shapes),type="skinCluster"); if not len(hist): ...