import os.path from dataclasses import dataclass from json import loads @dataclass class Path: core: str modules_standard: str modules_custom: str def _get_paths(path_to_json: str): with open(path_to_json, encoding="utf8") as f: paths = loads(f.read()) return Path( core=paths["core"], modules_standard=paths["modules standard"], modules_custom=paths["modules custom"] ) cwd = os.getcwd() cwd = cwd[:cwd.index('/src')] paths = _get_paths(f"{cwd}/paths.json")