How to change variable value in other module?
<p>I have the following modules:</p>

<p><strong>test.py</strong></p>

<pre><code>import test1


var1 = 'Test1'
var2 = 'Test2'

print var1
print var2

test1.modify_vars(var1, var2)

print var1
print var2
</code></pre>

<p>and the module </p>

<p><strong>test1.py</strong></p>

<pre><code>def modify_vars(var1, var2):
    var1 += '_changed'
    var2 += '_changed'
</code></pre>

<p>I am expecting to get the following output:</p>

<pre><code>Test1
Test2
Test1_changed
Test2_changed
</code></pre>

<p>I will get:</p>

<pre><code>Test1
Test2
Test1 
Test2
</code></pre>

<p>It is mandatory to avoid importing test module in test1 module.</p>

<p>How to achieve this without returning values from the method ? (sort of reference passing)</p>

<p>Your function misses a return value</p>

<pre><code>var1 = 'Test1'
var2 = 'Test2'

def modify_var(var1, var2):
    var1 += '_changed'
    var2 += '_changed'
    return (var1,var2)


(var1,var2) = modify_var(var1,var2)
print var1,var2
</code></pre>

<p>Does work. </p>

<p>I believe this requires minimal change to your code.</p>

<p>Tested with python 2.7</p>

python