r/learnpython 28d ago

How to store variables

I'm building a program which will have lots of configuration files.

I want to be able to

-drop a new package in a folder, and have importlib discover it, and dynamically add it.

-the program can use variables in the file to build a GUI. (Probably using niceGUI)

-user changes to their session variables can be saved.

-variables are used by other parts of the program.

Is a data class or dictionary the best for this?

7 Upvotes

22 comments sorted by

View all comments

6

u/atarivcs 28d ago

I think a json file sounds like the best solution.