I'm using setup.py to create a package foo and then installing it locally with pip install . in a fresh virtual env (python 2.7). In the virtual env's python interpreter I am able to import foo, but python seems to think foo is more a module than a python package (the package kind with the __init__.py file) because when I try to call into foo's substructure, foo.bar, it gives me an error about the module not having the bar attribute.
For example, I can import foo without issue but if I try and call anything off foo, it fails with error message:
>>> import foo
>>> foo.bar
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'bar'
Here's the folder structure:
foo/
foo/
__init__.py
bar.py
setup.py
Here's my setup.py file:
from setuptools import setup
setup(
url='none',
author='loren',
name='foo',
version='1.0.0',
packages=['foo'],
)
Interestingly, I can import bar with from foo import bar and not only does that work but it then fixes my above error and further calls to foo.bar returning the bar module, but that isn't very useful to me.
What do I need to do to get
>>> import foo
>>> foo.bar
to work properly?
__init__.pyfile?__init__.pyfile is empty