I am using this Info window with chart ESRI tutorial.

In a scenario where you have a lot of charts and the script becomes larger.
Is it possible to extract from the script the part that creates the charts and move it in another .js file?
So this file loads only if required by the user, not necessarily when loading the map?
Thank you,
Michelle