How to make __name__ == '__main__' when running module
<p>More specifically, I have a file</p>

<p>file file1.py:</p>

<pre><code>if __name__ == '__main__':
    a = 1
</code></pre>

<p>and from file file2.py, I want to do something like</p>

<pre><code>import file1
print file1.a
</code></pre>

<p>without modifying file1.py</p>
