You need to install js2py or requests-html packages to run the JavaScript program from Python
//example :
//javaScript function : squareofNum()
code in python :
import js2py
squareofNum = "function f(x) {return x*x;}"
result = js2py.eval_js(squareofNum)
print(result(5))
>>output : 25