intended to be used it' better if the resolution can be made explicit in code the relative imports solution in to address this dilemmaimports run within packages have changed in python to be absolute-only (and can be made so as an option in xunder this modelan import statement of the following form in our example file mypkg/main py will always find string module outside the packagevia an absolute import search of sys pathimport string imports string outside package (absolutea from import without leading-dot syntax is considered absolute as wellfrom string import name imports name from string outside package if you really want to import module from your package without giving its full path from the package rootthoughrelative imports are still possible if you use the dot syntax in the from statementfrom import string imports mypkg string here (relativethis form imports the string module relative to the current package only and is the relative equivalent to the prior import example' absolute form (both load module as wholewhen this special relative syntax is usedthe package' directory is the only directory searched we can also copy specific names from module with relative syntaxfrom string import name name imports names from mypkg string this statement again refers to the string module relative to the current package if this code appears in our mypkg main modulefor exampleit will import name and name from mypkg string in effectthe in relative import is taken to stand for the package directory containing the file in which the import appears an additional leading dot performs the relative import starting from the parent of the current package for examplethis statementfrom import spam imports sibling of mypkg will load sibling of mypkg-- the spam module located in the package' own container directorynext to mypkg more generallycode located in some module can use any of these formsfrom import from import imports means bimports means afrom import from import imports means bimports means apackage relative imports