通常的方法如下。
测试1。py
def some_func(): print 'in test 1, unproductive' if __name__ == '__main__': # test1.py executed as script # do something some_func()
服务py
import test1 def service_func(): print 'service func' if __name__ == '__main__': # service.py executed as script # do something service_func() test1.some_func()
看看 post-install script 因为pywin32可以(搜索快捷方式)。不确定Mac/Linux。