[Import-sig] import question

Michel Sanner sanner@scripps.edu
Fri, 16 Mar 2001 17:43:23 -0800

Hi, I didn't get any response on help-python.org so I figured I try these lists

if I have the follwoing packages hierarchy


I can use:

>>> from A.B import C

but if I use:

>>> import A
>>> print A
<module 'A' from 'A/__init__.pyc'>
>>> from A import B
print B
<module 'A.B' from 'A/B/__init__.py'>
>>> from B import C
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ImportError: No module named B

in order to get this to work I have to

>>> import sys
>>> sys.modules['B'] = B

Is that expected ?
In the documentation I read:

"from" module "import" identifier

so I expected "from B import C" to be legal since B is a module

I tried this with Python 1.5.2 and 2.0 on an sgi under IRIX6.5

Thanks for any help




>>>>>>>>>> AREA CODE CHANGE <<<<<<<<< we are now 858 !!!!!!!

Michel F. Sanner Ph.D.                   The Scripps Research Institute
Assistant Professor			Department of Molecular Biology
					  10550 North Torrey Pines Road
Tel. (858) 784-2341				     La Jolla, CA 92037
Fax. (858) 784-2860
sanner@scripps.edu                        http://www.scripps.edu/sanner