change os.system into direct python func call