DEV Community

Ram
Ram

Posted on

Better handle common imports across Python modules in an application

I am reaching out to get help on some best practices to handle common imports which is making import section ugly with lot of lines of code.

For instance, I have a python application suite with lot of modules with different directories (like utility, connectionprovider, configuration, datascience, etc).
I would use logging, os, json, dateutil, shutil and few other common standard libraries which are necessary in many modules. How can I avoid importing them in every single module, and rather have it in some place where its applicable for the entire directory or group of files.

Please help me with that!

Top comments (0)