python test.py start 1 2 3
test.py
def start(*kwargs): print('start') print(kwargs) def run(): print('run') def end(): print('start') import importlib def dynamic_import(module): return importlib.import_module(module) if __name__ == '__main__': module = dynamic_import('ppexpect_test') getattr(module, sys.argv[1])(sys.argv[2:])