alternativelya file can sometimes name its own package explicitly in an absolute import statementrelative to directory on sys path for examplein the followingmypkg will be found in an absolute directory on sys pathfrom mypkg import string imports mypkg string (absolutehoweverthis relies on both the configuration and the order of the module search path settingswhile relative import dot syntax does not in factthis form requires that the directory immediately containing mypkg be included in the module search path it probably is if mypkg is the package root (or else the package couldn' be used from the outside in the first place!)but this directory may be nested in much larger package tree if mypkg isn' the package' rootabsolute import statements must list all the directories below the package' root entry in sys path when naming packages explicitly like thisfrom system section mypkg import string system container on sys path only in large or deep packagesthat could be substantially more work to code than dotfrom import string relative import syntax with this latter formthe containing package is searched automaticallyregardless of the search path settingssearch path orderand directory nesting on the other handthe full-path absolute form will work regardless of how the file is being used--as part of program or package--as we'll explore ahead the scope of relative imports relative imports can seem bit perplexing on first encounterbut it helps if you remember few key points about themrelative imports apply to imports within packages only keep in mind that this feature' module search path change applies only to import statements within module files used as part of package--that isintrapackage imports normal imports in files not used as part of package still work exactly as described earlierautomatically searching the directory containing the top-level script first relative imports apply to the from statement only also remember that this feature' new syntax applies only to from statementsnot import statements it' detected by the fact that the module name in from begins with one or more dots (periodsmodule names that contain embedded dots but don' have leading dot are package importsnot relative imports in other wordspackage relative imports in really boil down to just the removal of ' inclusive search path behavior for packagesalong with the addition of special from syntax to explicitly request that relative package-only behavior be used if you coded your package imports in the past so that they did not depend upon ' implicit relative lookup ( by always spelling out full paths from package root)this change module packages