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] file_data = [] for m in modules: runner = importlib.import_module('.' + m, package=RUNNER_FOLDER) file_data = runner.main(file_data) ''' for script in scripts: runner = importlib.import_module('.' + script[:3], package=__name__) runner.main() '''