The script editor has following features that make the code edition easier:
The API functions can easily be accessed by typing the first 3 letters (usually sim). When a script was modified, there is no need to explicitly save the changes: closing the script editor, saving the scene or starting a simulation automatically applies the changes to the script. When a simulation is running, modifications to a given script only takes effect once a new simulation run is started. The user can also explicitly restart/reset a given script, for changes to take immediately effect.
If you have recurring functions you wish to access from a given script, or if you simply wish to run code from an external file, you can do following:
In that case, make sure the file is named myExternalLuaFile.lua or myExternalLuaFile.py, and do not forget to distribute it together with your scene or model, since that code will not be part of a CoppeliaSim file anymore. Searched path are usually following:
Files included via the require directive can be opened in the same script editor by opening the popup menu over the file name.
You can also set an external script editor by editing usrset.txt and restarting CoppeliaSim: a double-click on the script icon now opens the script in the specified external editor. Restarting the script can now be achieved by selecting the object associated with the script, and right-clicking in the scene hierarchy for the pop-up menu.