Probably meaning that you can avoid an import that overwrites an existing name:
from maya.cmds import *
would create a reference to a select()
in the global, which isn’t too bad initially until you do something like
from select import select
Now select()
refers to the version imported from the select module vs
import maya.cmds as mc
which creates mc.select()
.
Definitely good to come up with a set of blessed namespaces for your studio/team, at 343i we allow:
import pymel.core as pm
#or
import pymel.all as pm
# pymel.all is discouraged for production, usually we only allow this for prototyping and as the result of conversion
# scripts should be scaled back to pymel.core if possible before final code review
Slightly off topic but related, probably doesn’t hurt to have a standard order for importing either. Ours goes something like (off the top of my head):
# standard lib
import os
# external lib
import scipy
import pymel.core as pm
# C#
import clr
import System.Collections.ObjectModel
# internal lib
import animation.maya.api
import character.export
# siblings
import api
# plugins, privates, constants, etc
Seems like alot, but when dealing with code from numerous sources, consistency is key. In a pinch, PEP-8 is your friend.