import importlib import os from internals.util import getcwd path = os.path.join(getcwd(), "external/scripts") __scripts__ = [] for name in os.listdir(path): name = name.split("/")[-1].replace(".py", "") imp = importlib.import_module(f"external.scripts.{name}") if hasattr(imp, "Script") and imp not in __scripts__: __scripts__.append(imp)