I also wanted to do the same but $.getScript wasn’t importing the functions and I get only one error ie datatable is not a function.
Tried with static data and still the same issue. I can’t go to backend coz thats the only limitation I have. Although on testing instance i added those datatable’s js and css files and then ran the command bench build and then it worked but in real, I need to do the same but with custom script only.
Are you on the latest develop? If you’re on master or an older version of develop datatable might not be there. Check in your frappe’s package.json file and see if ‘frappe-datatable’ is listed as a dependency