Solution
@app.route("/engine", methods=["GET"])
def get_engine():
use_script = request.args.get("use_script")
if use_script:
get_text_from_pdf(config.doc_path) # Here I am calling python function
return render_template("engine.html")
Insight Engine