Untitled
unknown
python
3 years ago
663 B
4
Indexable
Never
from imp import reload from os import listdir from os import remove from os.path import isfile, join currentFile = __file__.replace('\\','/') folder = currentFile.split(currentFile.split('/')[-1])[0] all_files = [f for f in listdir(folder) if isfile(join(folder, f)) ] #[remove(join(folder, f)) for f in all_files if '.pyc' in f] py_files = [f for f in all_files if not '.pyc' in f] __all__ = [f.split('.')[0] for f in py_files if not '__init__' in f] print (__all__) #from . import * for script in __all__: print ('reload {0}'.format(script)) module = __import__('modules.{0}'.format(script)) print (module) reload(module)