0
myMain.py
/myPackage
    file1.py
    file2.py
    confFile.cfg

myMain.py imports file1 and file2 etc. and it reads the confFile. what would be the best way for the conf options to be visible in the whole package? i.e. for file1 and file2 to be able to read the conf options. I do not want to pass a lot of variables around in functions.

What I have right now is a confFile.py which i import into the files and read the variables defined from it as they are required.

I am new to python and any suggestions are appreciated.

/Zaar

Dzinx
  • 55,586
  • 10
  • 60
  • 78

1 Answers1

1

I think the best way is to just have a python module config.py or settings.py and store those settings directly in those python files instead of the confFile.cfg.

Then you could just get anything you want by:

import config
config.my_specific_option
Slater Victoroff
  • 21,376
  • 21
  • 85
  • 144
Bogdan
  • 8,017
  • 6
  • 48
  • 64