Its dependent on a concept i call script in point.
See scripts them procs are found by maya automaticaly if they are in memory, they are in memory if they are sourced.
Maya has a seconda y way of searching for theese scripts and thets the filename hash, 2wich is all the files in the lookup directory.
Now whenever you invoke a command maya goes ahead and cheks if such a command is in memory if so it runs it, IF not it cheks to see if theres a filename named after the proc if such exists (actualy since maya 6.5 this listy is done ONCE during maya startup so if you want to add files to the path with maya running you must instruct maya to reahash the lookup) it sources that proc.
NOW a file itself can have MANY global procedures defined, so for example a file named foo.mel in searchpath containing global procs foo, and bar then calling
bar()
//not found//
will not work, but calling
foo ()
will and subsequently also calling
bar ()
after foo will work.
NOW alot of maya functionality is loaded during GUI startup wich means a whole lot of porcesses that dont have a inpoint are loaded into memory, ths enabling you to use them. However if you launch maya in batch mode theese procs arent defined because no gui vas loaded.
But what happens if ther same porc is defined 2 times? a lot of touble becaus eit hard to know wich one it will choose whanever ESPECIALy if they are part of non inpoint procs! But ocasionaly this is usefull. for example lets say you have the factoryscript file
mayadir/scripts/others/factorScript.mel
qand you wanted to change it... THen all you do is you copy the file to your
Userdir/scripts/factorScript.mel
and edit that file... maya now opts to use it instead, because maya looks for first occourence of factorScript.mel and the factory paths are defined first and maya has a reverse priority (path added last has highest priority of chekup)
Or say you have a AE template and need to override it BUT only for the current scene then you just define a new AEproc in your maya session and it instead will be sued, not the one on disk.