The difference between "import package.module" and "from packageimport module"(about pymol)

Fredrik Lundh fredrik at pythonware.com
Fri Dec 16 03:06:31 EST 2005


Xiao Jianfeng wrote:

> In pymol I can use "from chempy import Atom" but "import
> chempy.Atom" doesn't work. It says,"ImportError: No module
> named Atom". What is going wrong ?

are you sure Atom is a module ?

compare:

>>> from os import remove
>>> remove
<built-in function remove>

>>> import os.remove
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named remove

</F>






More information about the Python-list mailing list