19 lines
591 B
Python
19 lines
591 B
Python
|
from os import listdir
|
||
|
from os.path import isdir, isfile, dirname, abspath, basename, join
|
||
|
from importlib import import_module
|
||
|
from ..dispatcher import dispatcher
|
||
|
|
||
|
|
||
|
def list_import():
|
||
|
abs_here = dirname(abspath(__file__))
|
||
|
here = basename(abs_here)
|
||
|
module = basename(dirname(abs_here))
|
||
|
for filename in listdir(abs_here):
|
||
|
absfilename = join(abs_here, filename)
|
||
|
if isdir(absfilename) and isfile(join(absfilename, '__init__.py')):
|
||
|
dispatcher.set_module(filename, import_module(f'.{here}.{filename}', module))
|
||
|
dispatcher.validate()
|
||
|
|
||
|
|
||
|
list_import()
|