This is a general questions about #include.
I wrote a very long script (around 2000 lines) that imports idml files that have been translated, creates new paragraph styles based on the language, searches the text for keywords and adds hyperlinks to them. Although it worked, it was temperamental. Sometimes it would error, sometimes it just wouldn't create the hyperlinks, and other times it just told me that objects were invalid.
So, since the script was made up of individual functions that each had a small task, I separated them into their own .jsx file and included them in one main file using #include. Then, I just called them one by one.
Now, it works every time, no errors.
I'm wondering, is there something 'under the hood' that I should know about #include?
If anyone can shed some light on this, I'd appreciate it
#include simply links whatever is in the include file, that's all. When you got the script to work after disecting it and placing various things in include files, you probably changed some of the logic and that made things work. There's no magic in #include.