I think you're missing a few key concepts here.
What you're asking at the moment isn't really possible (To call your backend Python function within your JavaScript
file).
What is possible is using REST apis to interact with your Python
backend from JavaScript
.
You can use python frameworks like Django or Flask to create backend Python
APIS.
I suggest you do a bit of reading on REST, as it's the bread and butter for interacting with backends via front end web applications. Here is a good introduction to REST while using the Flask
framework.
I think if you work your way through the above, then read about how to interact with API's via JavaScript
. This stackoverflow answer here is a great resource on it.