Call functions from others js file

We use as starting point the example BPMN.html.
The file contains an Init function that contains all the possible customization for the diagram. Now what we would like to do is to de-centralize the code in multiple files.
But we have problems.
Is possible to move variables and functions from our Init function. We would like to avoid to inlcude all everytime. We had moved some function that were outside OnInit, We would like to move some that are in the onInit,
One things we have done is to move the variables which were inside the init function outside.
And we moved also some functions. But in the end we got an error a Runtime error on setting window.myDiagram = …
We have now two include: one with the file with inizialization and another one is a javascript with the all the functions that were outside the Init and some others taken from Init function of the first js.
We start adding functions each time the compiler told us that the function were missed or needed.
We add a few, that runs fine, but then when the Init is called an error arise , it seems coming from library go.js

Yes, the examples tend to put all of the initialization together in one function, even though the definitions as well as the initialization could easily have been put into separate files. That was to make it clearer which code belongs to each sample – everything was put into a single file for simplicity, except some data files.

You’ll need to figure that out yourself, since it really is JavaScript coding unrelated to GoJS.