Ah, thank you once again. I didn't notice that line!
Now I understand what you meant about typing in 'find_next_trade_route()'. Obviously the lua function code would need to be written anyway and presumably placed in one of the game files, but it seems that a much better/quicker/easier way (at least at the moment) is to use an external text editor to create and edit the lua script. Pressing 'Load Lua Script' and locating a file find_next_trade_route.lua would, for me anyway, be much preferable to typing in the function name in that edit line (and inevitably misspelling!).
Of course I intend to test this, but at first I am assuming that when you load a file it parses through to find the first executable code which isn't a function and runs from that point (if my memory serves me correctly from using lua in the dim distant past). I am also assuming that a function defined in the file you are running will be executed even if there is an identically named object elsewhere (known as local scope override or something!). If those assumptions hold, it may be better to have a "library" file with all the additional (or overridden) lua functions and just have the line(s) at the bottom with the specific code to run, which could be find_next_trade_route() - just hoping that the "hour glass" doesn't live up to it's name!
I did wonder how I might write that trade route utility. In-game I tend to choose the farthest city from the caravan/freight owner which doesn't already have the maximum number (on another continent if possible), but that's probably not always the "best" route.
Anyway apologies for waffling away for hours.