--by using absolute or relative import syntax in xyou can either skip or select the package directory explicitly in factthis is the use case that the model addressescode\pkg\spam py from import string print(string<=relative in both and code\pkg\string py print('ni :\codec:\python \python import pkg spam nininininininini :\codec:\python \python import pkg spam nininininininini relative imports search packages only it' also important to note that relative import syntax is really binding declarationnot just preference if we delete the string py file and any associated byte code in this example nowthe relative import in spam py fails in both and xinstead of falling back on the standard library (or any otherversion of this modulecode\pkg\spam py from import string <=fails in both and if no string py herec:\codedel pkg\stringc:\codec:\python \python import pkg spam importerrorcannot import name string :\codec:\python \python import pkg spam importerrorcannot import name string modules referenced by relative imports must exist in the package directory imports are still relative to the cwdagain although absolute imports let you skip package modules this waythey still rely on other components of sys path for one last testlet' define two string modules of our own in the followingthere is one module by that name in the cwdone in the packageand another in the standard librarycode\string py print('string code\pkg\spam py package relative imports