from os.path import join from pathlib import Path groups = {} for group in Path(join(repo_path, "groups")).rglob("*.py"): with open(group, 'r') as f: exec(f.read())