import execjs
def runJS(filePath, funcName, *args):
with open(filePath, 'r', encoding='utf-8') as f:
jscode = f.read()
ctx = execjs.compile(jscode)
res = ctx.call(funcName, *args)
return res
return_value = runJS('test.js', '函數名', "函數參數1")