How to use variable of one function to another function without declaring global variable in this case?
<p>I have a function like this:</p>

<pre><code>def upload_file(request):
    if request.method == 'POST':    
        # session_name = request.POST['session']

        url = request.POST['hostname']

        username = request.POST['username']

        password = request.POST['password']
</code></pre>

<p>This function gets the hostname, username and password from a form and store in a respective variable. I want to use the variables url, username and password in another function:</p>

<pre><code>def another_function():
    print url, username, password
</code></pre>

<p>What's the right way to do this? I could make upload_file return the variable and use that but I guess it can be done only with one variable. </p>
