Is there a way to call a python function when a certain link is clicked within a html page?
Thanks
Yes, but not directly; you can set the onclick handler to invoke a JavaScript function that will construct an XMLHttpRequest object and send a request to a page on your server. That page on your server can, in turn, be implemented using Python and do whatever it would need to do.
Call a python function within a html file