import sound.effects.echo import sound.effects.surround from sound.effectsimport * 

In this example, the echo and surround modules are imported in the current namespace because they are defined in the sound.effects package when the from...import statement is executed. (This also works when __all__ is defined.) 

Although certain modules are designed to export only names that follow certain patterns when you use$_{import *}$ , it is still considered bad practice in production code. 

Remember, there is nothing wrong with using from package import specific_submodule ! In fact, this is the recommended notation unless the importing module needs to use submodules with the same name from different packages. 

## 6.4.2 Intra-package References 

When packages are structured into subpackages (as with the$_{sound}$package in the example), you can use absolute imports to refer to submodules of siblings packages. For example, if the module sound.filters.vocoder needs to use the echo module in the sound.effects package, it can use from sound.effects import $_{echo}$. 

You can also write relative imports, with the$_{from module import name}$ form of import statement. These imports use leading dots to indicate the current and parent packages involved in the relative import. From the $_{surround}$module for example, you might use: 

from .import echo from ..import formats from ..filters import equalizer 

Note that relative imports are based on the name of the current module. Since the name of the main module is always "__main__" , modules intended for use as the main module of a Python application must always use absolute imports. 

## 6.4.3 Packages in Multiple Directories 

Packages support one more special attribute, __path__ . This is initialized to be a list containing the name of the directory holding the package’s$_{__init__.py}$ before the code in that file is executed. This variable can be modified; doing so affects future searches for modules and subpackages contained in the package. 

While this feature is not often needed, it can be used to extend the set of modules found in a package. 

