Import module from a different subdirectory

Inada Naoki songofacandy at
Fri May 17 01:25:55 EDT 2019

2019年5月17日(金) 9:25 Rich Shepard <rshepard at>:
> My understanding is that Python3 does not require subdirectories to have an
> file, only Python2 does. If that's not correct I'll add the
> blank file.

This is slightly off topic (not relating to your problem), but please don't
think "Python 3 doesn't require for packages".
It is common misunderstanding.

Package directory without is "namespace package".
Namespace package is not a regular package.  See [1] for detail.


There are some difference between regular package and namespace package.
They have different module search order.  Testing tools including unittest
doesn't search namespace package.  (If they do, they may take minutes
to search million files in `node_modules` directory in your project!)
So abusing namespace package will bite you at some point.

Inada Naoki  <songofacandy at>

More information about the Python-list mailing list