import glob import importlib import os import subprocess import sys RUNNER_FOLDER = 'runners' scripts = glob.glob(f"./{RUNNER_FOLDER}/*.py") scripts.sort() modules = [os.path.basename(x)[:-3] for x in scripts] for m in modules: runner = importlib.import_module('.' + m, package=RUNNER_FOLDER) runner.main() ''' for script in scripts: runner = importlib.import_module('.' + script[:3], package=__name__) runner.main() '''