[Tutor] sibling import

Atar new newatar51 at gmail.com
Thu Oct 12 07:15:39 EDT 2017


Hi Team,

Here is my problem. I want to use sibling import but it is not working . I
know taht if we add the directory in sys.path ,it will work.

But I have to package the whole application and will create a setup.py file
out of it .
What is the standard way to do it?


   1. mkdir A
   2. mkdir B
   3.
   4. touch A/__init__.py
   5. touch B/__init__.py
   6.
   7. touch A/foo.py
   8. touch B/bar.py
   9.
   10. cat B/bar.py
   11. from A import foo
   12.
   13.
   14. python B/bar.py
   15. ImportError: No module named A



Thanks
Anju


More information about the Tutor mailing list