I\'m currently writing a class that needs os, stat and some others.
What\'s the best way to import these modules in my class?
I\'m
PEP 8 on imports:
Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
This makes it easy to see all modules used by the file at hand, and avoids having to replicate the import in several places when a module is used in more than one place. Everything else (e.g. function-/method-level imports) should be an absolute exception and needs to be justified well.