Here's an example -- but, as a general rule, you shouldn't use wildcard imports (only under narrowly defined circumstances, and only if you define __all__
).
# Directory structure.
.
├── foopack/
│ ├── __init__.py
│ ├── data.py
│ └── plot.py
└── run.py
# foopack/data.py
class Data(object):
def blah(self):
print self.x
# foopack/plot.py
def dplot():
print 'dplot()'
# foopack/__init__.py
# Here we use relative imports and define __all__.
from .data import Data
from .plot import dplot
__all__ = 'Data dplot'.split()
# A demo script: demo.py
from foopack import *
d = Data()
d.x = 32
d.blah()
dplot()