File structure:
./__init__.py
a.py
/lib
__init__.py
Foo1.py # contains `class Foo1`
Foo2.py # contains `class Foo2`
# so on ...
Tested this in a.py
and worked, doing this;
from lib.Foo1 import Foo1
from lib.Foo2 import Foo2
But, when I do from lib import *
the __all__ = ["Foo1", "Foo2"]
in __init__.py
it doesn't work.
Error: <type 'exceptions.TypeError'>: 'module' object is not callable
What I'm missing?
Here is a.py
;
#!/usr/bin/python
import cgi, cgitb
cgitb.enable()
from lib import *
print "Content-Type: text/html"
print ""
print "Test!"
foo1 = Foo1()
foo2 = Foo2()
Used these refs:
http://docs.python.org/2/tutorial/modules.html#importing-from-a-package
How to load all modules in a folder?