js file in second.js file. both files are defined in an HTML file like How can a parameterized function in one .js file be called from another . js file? The open-win() function is working perfectly fine and pops up a new window when called. But the problem is that im not able to call dispval() function from within the openwin() function using the onclick event of the button. Earlier it was giving error Failed: path must be a string Stack:. After making the changes as path.join(dirname, xmlPath), it works but calling same function from another js file prints undefined. Can someone help. I wanna re-use those functions in another file. In my second js file, I wanna simply call themI have no HTML file which is running and I dont wanna use such solution because, in fact, my senond. js is compiled in another step. call a function within another function.