How can I call a Javascript function from Python (severside)

i have a function in file , i have crated custom javascript file in the app folder called library_management.js,

app folder

.js file file

Unfortunately there are no push notifications implemented in ERPNext.

You can keep pollling from javascript every 3-4 seconds to check if there is a call.

actually my py function is in, am not able to connect a javascript file from python, thats what my qstion how i can link a javascript file to file.

using below script for polling the python function, but whitelist python function is not passing any value to java script.

(function poll(){


url: "/api/method/library_management.library_management.doctype.library_customers.library_customers.callfrom_asterisk",
success: function (data) {
dataType: "json",
complete: poll,
timeout: 30000


Check your network tab. There should be a result, or there could be an error.