print('in mod py' heredir will be either an immediate subdirectory of the one we're working in ( the home directory)or an immediate subdirectory of directory that is listed on the module search path (technicallyon sys patheither waydir ' container does not need an __init__ py file import statements run each directory' initialization file the first time that directory is traversedas python descends the pathprint statements are included here to trace their executionc:\codepython import dir dir mod dir init dir init in mod py import dir dir mod run in dir ' container directory first imports run init files later imports do not just like module filesan already imported directory may be passed to reload to force reexecution of that single item as shown herereload accepts dotted pathname to reload nested directories and filesfrom imp import reload from needed in only reload(dir dir init reload(dir dir dir init once importedthe path in your import statement becomes nested object path in your script heremod is an object nested in the object dir which in turn is nested in the object dir dir dir dir dir dir mod in facteach directory name in the path becomes variable assigned to module object whose namespace is initialized by all the assignments in that directory' __init__ py file dir refers to the variable assigned in dir \__init__ pymuch as mod refers to the variable assigned in mod pydir dir dir module packages