To work with the runpy interface, we must add a small __main__.py module to our application's top-level package. We have emphasized the design of this top-level executable script file.
We should always permit refactoring an application to build a larger, more sophisticated composite application. If there's functionality buried in __main__.py, we need to pull this into a module with a clear, importable name so that it can be used by other applications.
A __main__.py module follows the kind of code shown in the previous section, Creating an executable script file. The only real distinction is using the special name, __main__.py, to make it easier for the Python runtime to locate the main module of a package. It also makes it easier for other people to locate the main part of a package's processing.
One of the important considerations in Python programming is combining multiple, smaller programs into useful, larger programs. In the next section, we'll look at aggregation, or programming in the large.