I commonly use the python idiom: if __name__=="__main__": runMainRoutine() If I use "Run Module" in Idle, this doesn't work because it is not the main module. Is there some variable or flag I can test to see if I'm running a main module from Idle? --Jeff