▲ | necovek 5 months ago | |||||||
Logging configuration is done at import time for "utils" module. Imagine code like this: main.py:
Or two "commands", one importing utils and another not: they would non-obviously use different logging configuration.It gets even crazier: you could import utils to set the configuration, override it, but a second import would not re-set it, as module imports are cached. Basically, don't do it and no unexpected, confusing behaviour anywhere. | ||||||||
▲ | bumblehean 5 months ago | parent [-] | |||||||
As a non Python developer, what would be the use-case(s) for importing a module inside of the main function instead of importing it at the top of main.py with the others? | ||||||||
|