import sys, json; from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) import reference as R, texts Path(__file__).resolve().parents[1].joinpath("data", "ids.json").write_text(json.dumps([R.text_ids(t) for t in texts.TEXTS])) print("ids", len(texts.TEXTS))