Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to import a all the modules in a packege python

from os.path import dirname, basename, isfile, join
import glob
modules = glob.glob(join(dirname(__file__), "*.py"))
__all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #import #modules #packege #python
ADD COMMENT
Topic
Name
2+2 =