I have a package like this
sound/
__init__.py
effects/
__init__.py
echo.py
formats/
__init__.py
avi.py
inside avi.py i have import statement like this
from sound.effects import echo
this code throws No Module Named sound.effect error
From the pythondocs i understood that this is possible. And I am search through stackoverflow
and found related question and answers, but I couldn’t understand them.
Please help me to solve this.
Thanks,
Prawyn.
If you’re running
avi.pyfrom theformatsfolder, and don’t adjust yourPYTHONPATH, Python won’t be able to find theeffectspackage. Try running your code from outside the sounds directory, modifying yourPYTHONPATHenvironment variable such that it includes the directory in whichsoundlives is part of thtat, or changing yourPYTHONPATHat runtime (see e.g. this link).