In python, how to restore the function of os.chdir() if os.chdir = 'path' has been implemented
<p>In path setup, I wrongly wrote the code: os.chdir = '\some path', which turns the function os.chdir() into a string. Is there any quick way to restore the function without restarting the software? Thanks!</p>

<pre><code>&gt;&gt;&gt; import os
</code></pre>

<p>Assign to the <code>chdir</code> method a string value:</p>

<pre><code>&gt;&gt;&gt; os.chdir = '\some path'
&gt;&gt;&gt; os.chdir
'\some path'
</code></pre>

<p>Use <code>reload</code> to, well, reload the module. <code>reload</code> will reload a <em>previously imported</em> module.</p>

<pre><code>&gt;&gt;&gt; reload(os)
&gt;&gt;&gt; os.chdir
&lt;built-in function chdir&gt;
</code></pre>

python