prefixeswhich lead to the leftmost names in import and from statements these import statements themselves provide the remainder of the directory path in platform-neutral fashion as for simple file importsyou don' need to add the container directory dir to your module search path if it' already there--per it will be if it' the home directory of the top-level filethe directory you're working in interactivelya standard library directoryor the site-packages third-party install root one way or anotherthoughyour module search path must include all the directories containing leftmost components in your code' package import statements package __init__ py files if you choose to use package importsthere is one more constraint you must followat least until python each directory named within the path of package import statement must contain file named __init__ pyor your package imports will fail that isin the example we've been usingboth dir and dir must contain file called __init__ pythe container directory dir does not require such file because it' not listed in the import statement itself more formallyfor directory structure such as thisdir \dir \dir \mod py and an import statement of the formimport dir dir mod the following rules applydir and dir both must contain an __init__ py file dir the containerdoes not require an __init__ py filethis file will simply be ignored if present dir not dir \dir must be listed on the module search path sys path to satisfy the first two of these rulespackage creators must create files of the sort we'll explore here to satisfy the latter of thesedir must be an automatic path component (the homelibrariesor site-packages directories)or be given in pythonpath or pth file settings or manual sys path changes the dot path syntax was chosen partly for platform neutralitybut also because paths in import statements become real nested object paths this syntax also means that you may get odd error messages if you forget to omit the py in your import statements for exampleimport mod py is assumed to be directory path import--it loads mod pythen tries to load mod\py pyand ultimately issues potentially confusing "no module named pyerror message as of python this error message has been improved to say "no module named ' py' is not package package import basics