import dualpkg :\codepy - import dualpkg :\codepy - dualpkg\ py :\codepy - dualpkg\ py ok ok failsfailsconverselya simple import statement works in nonpackage mode in both and xbut fails in package mode in onlybecause such statements do not search the package directory in xcode\dualpkg\ py import :\codepy - import dualpkg :\codepy - import dualpkg :\codepy - dualpkg\ py :\codepy - dualpkg\ py failsok ok ok and finallyusing full package paths works again in both usage modes and pythonsas long as the package' root is on the module search path (as it must be to be used elsewhere)code\dualpkg\ py import dualpkg as :\codepy - import dualpkg :\codepy - import dualpkg :\codepy - dualpkg\ py :\codepy - dualpkg\ py andset pythonpath= :\code ok ok ok ok in sumunless you're willing and able to isolate your modules in subdirectories below scriptsfull package path imports are probably preferable to package-relative imports --though they're more typingthey handle all casesand they work the same in and there may be additional workarounds that involve extra tasks ( manually setting sys path in your code)but we'll skip them here because they are more obscure and rely on import semanticswhich is error-pronefull package imports rely only on the basic package mechanism naturallythe extent to which this may impact your modules can vary per packageabsolute imports may also require changes when directories are reorganizedand relative imports may become invalid if local module is relocated package relative imports