python - Does __init__.py create a namespace, or does it take on the pkg-namespace? -
python - Does __init__.py create a namespace, or does it take on the pkg-namespace? -
foopkg |- __init__.py |- bar.py |- baz.py __init__.py bar import * baz import * suds.client import client client bar.py class croak: import foopkg foopkg.client()
python3.2>> import foopkg
attributeerror: 'module' object has no attribute 'client'
why??
you importing bar before client. so, @ moment foopkg.client() gets executed foopkg has no client yet.
python python-3.x
Comments
Post a Comment