imports within package are absolute-only by default--in the absence of any special dot syntaximports skip the containing package itself and look elsewhere on the sys path search path for examplein both python and statement of the formrelative to this package from import spam instructs python to import module named spam located in the same package directory as the file in which this statement appears similarlythis statementfrom spam import name means "from module named spam located in the same package as the file that contains this statementimport the variable name the behavior of statement without the leading dot depends on which version of python you use in xsuch an import will still default to the original relative-thenabsolute search path order ( searching the package' directory first)unless statement of the following form is included at the top of the importing file (as its first executable statement)from __future__ import absolute_import use relative import model in if presentthis statement enables the python absolute-only search path change in xand in when enabledan import without leading dot in the module name always causes python to skip the relative components of the module import search path and look instead in the absolute directories that sys path contains for instancein ' modela statement of the following form will always find string module somewhere on sys pathinstead of module of the same name in the packageimport string skip this package' version by contrastwithout the from __future__ statement in xif there' local string module in the packageit will be imported instead to get the same behavior in xand in when the absolute import change is enabledrun statement of the following form to force relative importfrom import string searches this package only this statement works in both python and today the only difference in the model is that it is required in order to load module that is located in the same package directory as the file in which this appearswhen the file is being used as part of package (and unless full package paths are spelled outnotice that leading dots can be used to force relative imports only with the from statementnot with the import statement in python xthe import modname statement is always absolute-onlyskipping the containing package' directory in xthis statement form still performs relative importssearching the package' directory first from statements without leading dots behave the same as import statements--absolute-only package relative imports