2
从命令行调用顶级python 包时是否可以执行操作?使顶层python模块可调用?
例如,我现在的结构是这样的:
MyApp
| - subdir1
| - pyfile.py
| - pyfile.py
| - pyfile.py
| - subdir2
| - subsubdir1
| - pyfile.py
| - pyfile.py
- __init__
- other.py
我可以做所有的正常的东西。例如from MyApp.subdir1 import pyfile
。
不过,我想允许用户通过命令行的顶级名称调用应用程序,并把它做一些
python MyApp [options]
而不是必须的范围之与一个特定的模块,它们main()
func
python /path/to/MyApp/actions/somemodule.py [options]
这是不是可能?