let's say you have the script myScript.py in witch you have the function doStuff()
simply do this in the maya command line:
import myScript
reload(myScript)
myScript.doStuff()
drag this in a shelf... now you simply have to edit the script in a real editor (ultraedit, wingIDE, eclipse, etc)
save the file in the external editor
press the shelf button
![]()
enjoy