[Tutor] import and unittest

Kent Johnson kent37 at tds.net
Wed Jan 17 13:50:18 CET 2007


Thomas Coopman wrote:
> Well I don't really 
> need the circular imports but I would like to know how to do the imports correct. 
> 
> Suppose that in the example that I showed only One needs Two.
> 
> So then we have this:
> 
> M/
> __init__.py
> A/
> __init__.py
> One.py
> B/
> __init__.py
> Two.py
> 
> One.py
> #!/usr/bin/python
> 
> from M.B import Two
> 
> 
> when I run this I get this error:
> ImportError: No Module named M.B

Is the directory containing M in sys.path?

Kent



More information about the Tutor mailing list