Is it possible to perform an action when a top level python package is called from the command line?
For example, my current structure looks like this:
MyApp
| - subdir1
| - pyfile.py
| - pyfile.py
| - pyfile.py
| - subdir2
| - subsubdir1
| - pyfile.py
| - pyfile.py
- __init__
- other.py
And I can do all the normal stuff. e.g. from MyApp.subdir1 import pyfile
.
However, I'd like to allow users to call the app via its top level name from command line and have it do something
python MyApp [options]
Rather than them having to scope it to a specific module with a main()
func
python /path/to/MyApp/actions/somemodule.py [options]
Is this at all possible?