1. Create a file called __init__.py in the directory containing the modules (.py files)
2. Paste this code into __init__.py
xxxxxxxxxx
import os
__all__ = []
for module in os.listdir(os.path.dirname(__file__)):
if module == '__init__.py' or module[-3:] != '.py':
continue
__all__.append(module[:-3])
del module
del os
You will now be able to access all the modules in that dir when you import *
xxxxxxxxxx
from myDir import *