Attempted relative import beyond toplevel package
问题 Here is my folder structure: Mopy/ # no init.py ! bash/ __init__.py bash.py # <--- Edit: yep there is such a module too bass.py bosh/ __init__.py # contains from .. import bass bsa_files.py ... test_bash\ __init__.py # code below test_bosh\ __init__.py test_bsa_files.py In test_bash\__init__.py I have: import sys from os.path import dirname, abspath, join, sep mopy = dirname(dirname(abspath(__file__))) assert mopy.split(sep)[-1].lower() == 'mopy' sys.path.append(mopy) print 'Mopy folder