Call .js scripts in function node

I use node red for a while now, not very solid in programming yet.
Now I have a principal question:

I run node red in docker on a ubuntu server.

I would to play around with tensorflow and found an example on github that I would like to replicate in node red. This is not a Node Red specific project.

I installed tensorflow inside the node red container.
The example has an index.html, script.js and model.js file.
I put script.js and model.js in separate function nodes. The index.html in a UI template node.

Right of the bat I can tell that I cannot call script.js and model.js in the UI template node. So I am planning to replicate calling the functions inside the .js files by using node red nodes like UI buttons and such.

I thought it would be wise to ask this question before potentially wasting weeks and finding out it's not possible in node red.

Is this the correct approach? Can I use javascript that calls on the tensorflow module in a function node and, with a bit of fiddling, replicate such a project?