<reponame>cmcpasserby/MayaCharm<gh_stars>100-1000
import maya.cmds as cmds

if not cmds.commandPort(":{0,number,#}", query=True):
    cmds.commandPort(name=":{0,number,#}")

import maya.cmds as cmds

if not cmds.commandPort(":{0,number,#}", query=True):
    cmds.commandPort(name=":{0,number,#}")
#}", query=True): #}")