Is there a way to tell when a python file is loaded using PYTHONSTARTUP vs. being run as a script?
<p>All,
  I recently discovered the PYTHONSTARTUP environment variable, and am looking forward to setting up several of my utility functions to automatically load into my interpreter.  However, one thing I'd like to be able to do is use the same script to setup the environment variable itself.  </p>

<p>My issue is determining when the file is run as a script.  My thought was to use the <code>if __name__ == "__main__":</code> trick to determine when the file was run as a script, but testing showed that when the file is loaded via PYTHONSTARTUP the name shows as <code>"__main__"</code>.</p>

<p>Does anyone know of a way to identify when a file is run as a script vs. when it is loaded via PYTHONSTARTUP?</p>
