we can use more periods to go further up the hierarchy of coursewe can also go down one side and back up the other we don' have deep enough example hierarchy to illustrate this properlybut the following would be valid import if we had an ecommerce contact package containing an email module and wanted to import the send_mail function into our paypal modulefrom contact email import send_mail this import uses two periods to saythe parent of the payments packageand then uses the normal package module syntax to go back up into the contact package finallywe can import code directly from packagesas opposed to just modules inside packages in this examplewe have an ecommerce package containing two modules named database py and products py the database module contains db variable that is accessed from lot of places wouldn' it be convenient if this could be imported as import ecommerce db instead of import ecommerce database dbremember the __init__ py file that defines directory as packagethis file can contain any variable or class declarations we likeand they will be available as part of the package in our exampleif the ecommerce/__init__ py file contained this linefrom database import db we can then access the db attribute from main py or any other file using this importfrom ecommerce import db it might help to think of the __init__ py file as if it was an ecommerce py file if that file were module instead of package this can also be useful if you put all your code in single module and later decide to break it up into package of modules the __init__ py file for the new package can still be the main point of contact for other modules talking to itbut the code can be internally organized into several different modules or subpackages recommend not putting all your code in an __init__ py filethough programmers do not expect actual logic to happen in this fileand much like with from import *it can trip them up if they are looking for the declaration of particular piece of code and can' find it until they check __init__ py