There are multiple ways to run the scripts.
I assume that you run them from the editor (f9 I think, although I am not in front of PI). The trick is that the Javascript environment stays alive between two executions in the editor. So global variables of one execution remains in the next one. For example if you make a typo like calling a function 'maim' instead of 'main', your script would call the 'main' defined in the previous script you executed.
The trick is to reset the Javascript engine before execution (somewhere on an execute menu in the script editor), in case of problem.
A good practice is also to initialize everything in a script and start it with "use strict"; as the first line. You may get better error messages.
This is only one of the bad things that may happen. It may be simpler. You may edit a file with the external editor and PI does not see it is modified. Or you installed the scripts as a feature and did not refresh them
I propose that you first try writing a 'script' that just does a write on the console, save them in two files (with different texts), and see if this works well. This should.
-- bitli
(PS. I do not know your background, I hope I did not give too obvious answers)