def parentCheck(obj): """ checks whether there's a parent and if so returns it (otherwise returns None)""" if obj: plist = cmds.listRelatives(obj, p=True) if plist: return(plist)[0] return(None)