ipython runs older version of script first before running new version
<p>I edited <em>oldscript.py</em> and then saved it in the same directory as <em>newscript.py</em>. After this, when I do <em>%run newscript.py</em> in ipython it seems to run <em>oldscript.py</em> before running <em>newscript.py</em>. I know this because it gives an output from <em>oldscript.py</em> before giving the outputs for <em>newscript.py</em>. It looks something like this:</p>

<pre><code>%run newscript.py
output from oldscript.py
outputs from newscript.py
</code></pre>

<p>Why is it doing this? I've deleted the .pyc files, but that didn't help. I restarted ipython, my terminal, and my computer and nothing has changed. As far as I know, I don't have anything pointing to <em>oldsript.py</em> in <em>newscript.py</em>. I'm in the correct directory. I also tried running it in spyder and the terminal. Both give the same outputs. I feel like I've tried everything. </p>

<p>Also, I should mention that I'm new to python so there may be an obvious solution I haven't tried. Please advise :)</p>

<p>I'm pretty sure I just figured it out. I removed <em>oldscript.py</em> from the directory and it worked! Who knew Python could be so particular?! Okay, probably a lot of you, but give me a break I'm a noob ;)</p>

python ipython