from dataclasses import dataclass import pickle @dataclass class Project: acronym: str title: str description: str amount: int if __name__ == "__main__": project1 = Project("acronym", "title", "description", 500) with open("file", "wb+") as file1: pickle.dump(project1, file1) with open("file", "rb") as file2: project2 = pickle.load(file2) print(project2)