How can I implement a control function in my program and avoid the AttributeError: 'module' object has no attribute error
<p>I have a simlair problem as in this question: <a href="http://stackoverflow.com/questions/1250103/attributeerror-module-object-has-no-attribute">AttributeError: &#39;module&#39; object has no attribute</a></p>

<p>I'm doing a mutual top level import which is causing me to have AttributeError: 'module' object has no attribute error so but I'm not sure if I can import within a function because I'm basically importing a file that controls all the other modules.</p>

<p>Here's an example(file2.py):</p>

<pre><code>import file1
count = 0
while count &lt; file1.number_of_loops:
 .....
</code></pre>

<p>My functions are being triggered by the control variables so I'm unable to import within the function itself.  Short of creating a sperate file to control, is there a way to refer to variables in another file without doing a mutual top level import?</p>
