I have a project with 10 different python files. It has classes and functions – pretty much the lot.
I do want to share specific data that will represent the settings in the project between all the project files.
I came up with creating a settings.py file:
settings = {}
settings['max_bitrate'] = 160000
settings['dl_dir'] = r"C:\Downloads"
and then I import the class from every file.
Is there a more suitable way to do it?
I’m probably a little old-school in this regard, but in my latest project, I created a config file in
/etc, then created aconfigmodule that usesConfigParserto read it in and make it available, and import thatconfigmodule wherever I need to read settings.