I understand that there is already a similar query here.
My query is different from the above; I have a function that is already defined in my Python script (a Flask app). I want to be able to call this function in my HTML script WITHOUT going to another webpage/URL (meaning that there is no need to create an @app.route in the Python script).
I want it to be such that when the user clicks on the link, the function is called (it's a visual plotting function), and on the same page/URL the plot is created and displayed.
How can this be done in general? Thank you.