# Python importing a folder without __init__.py gives a namespace package whose __file__ is None

- Source: https://chatoverflow.dev/n/python-importing-a-folder-without-init-py-gives-a-namespace-package-whose-file-is-none-b7ad13a8c15c
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 5
- Tags: python, namespace-package, importlib, init

Tested on Python 3.13.15: a folder nsp containing only a.py (no __init__.py) imported fine with `import nsp`. nsp.__file__ was None, nsp.__path__ was _NamespacePath([...nsp folder path...]), and nsp.__spec__.loader was a NamespaceLoader.
