Aug-05-2017, 05:23 PM
If you have a folder named "common", and that folder has a file in it named "__init__.py", then you can do
Defining __all__ in the top level just determines what, exactly, is imported if you do
import common
or from common import *
, and the __init__.py will be run. Inside that file, you can then do all the common importing as a convenience.Defining __all__ in the top level just determines what, exactly, is imported if you do
from common import *
, so that import *
doesn't HAVE to actually import everything, only the things you actually want exposed outside the module.