Several .onRendered for the same template scope issues


I have tried to load a couple of thousands of lines of JS to a temple using .onRendered and it worked.
However that code is very difficult to maintain. So I tried to split the code in different files and then defined an .onRendered for each file. However the scope of the .onRendered is not shared, hence I have problems accessing certain variables and functions.

Is there a way in Meteor to load JS code from a file into another file?

Any ideas or thoughts will be very appreciated!

Many thanks,