Hello, I'm a mel user learning python.
I've started to read diveintopython and How to Think Like a Computer Scientist: Learning with Python v2nd Edition documentation
Concerning python import command to import module
Here's a few assumptions I gathered from my reading. If an experienced user could comment them, i'd really appreciate it.
import maya
This will import the entire maya moduleI can then run the ls command by calling the full maya.cmds namespace
maya.cmds.ls("*")
from maya import cmds
This import maya.cmds as cmds.
The relation inbetween maya and cmds is stated in the import line.Someone reading the script would know that cmds comes from maya.
I can then run the ls command by calling cmds
cmds.ls("*")
from maya import *
This import the full maya module as well, but gets rid of the relation inbetween maya and cmds. So unless someone has the knowledge that cmds belongs to maya, there is no way of knowing by simply reading the script. My guess is that there must be a way to figure the relation with some command unknown to me at the moment.
I can then run the ls command by calling cmds
cmds.ls("*")
from maya.cmds import *
This import the maya.cmds, and let you run the ls command straight.
ls("*")
Here again, I find that someone reading the script cant tell where the ls comes from.
So it feels to me that using the from module import * is a bad habit.
Sure it saves you some typing, but it makes it harder to figure out from which module a command comes from by reading the script.
Obviously if you import only one module, its pretty easy to figure out where the command comes from, but I see this method becoming problematic as you import multiple modules.
I suppose it could create namespace clashing if there is a def that has the same name in 2 different modules.
If you import 2 module with the from module import *, and those module have both a ls def, how does python handles this? Simple runTime error? or is there a sequence? like the first import line has precedence over the second one.
from moduleA import *
from moduleB import *
if a ls def exists in both module, which ls gets run?
I'm gonna test this out later, but in the mean time, if an experienced python programmer could give advice as to what is the best way to use the import command. I'd really appreciate it. I'd like to get into good habit right away 
P.S. hopefully I've used the correct term in my description.