and functionalbut we need to turn to more concrete code to see why the issue for examplein python it' common to use the same single directory as both program and packageusing normal undotted imports this relies on the script' home directory to resolve imports when used as programand the relative-then-absolute rule to resolve intrapackage imports when used as package this won' quite work in xthough--in package modeplain imports do not load modules in the same directory anymoreunless that directory also happens to be the same as the main file' container or the current working directory (and hencebe on sys pathhere' what this looks like in actionstripped to bare minimum of code (for brevity in this section again omit __init__ py package directory files required prior to python and for variety use the windows launcher covered in appendix )code\pkg\main py import spam code\pkg\spam py import eggs <=works if in home of main script file code\pkg\eggs py print('eggs but won' load this file when used as pkg in xc:\codepython pkg\main py eggseggseggseggs :\codepython pkg\spam py eggseggseggseggs ok as programin both and :\codepy - import pkg spam eggseggseggseggs ok as package in xrelative-then-absolute xplain imports search package directory first :\codepy - but fails to find file hereabsolute only import pkg spam xplain imports search only cwd plus sys path importerrorno module named 'eggsyour next step might be to add the required relative import syntax for usebut it won' help here the following retains the single directory for both main top-level script and package modulesand adds the required dots--in both and this now works when the directory is imported as packagebut fails when it is used as program directory (including attempts to run module as script directly)code\pkg\main py import spam code\pkg\spam py from import eggs code\pkg\eggs py module packages <=not package if main file here (even if me)