How To Call A Function With Proper 'Arguments'
<p>I have a function that takes 2 returned variables from another function to write them with a little bit more padding text to an external text file.</p>

<p>The code that I am using to write to the text file is below but it is being called automatically at runtime with the <code>if</code> statement at the bottom of the program</p>

<pre><code>def function1()
# Some code

def function2()
# Some code
return startNode
return endNode

def function3(var)
# Some code
return differentVariable

def createFile(startNode, endNode):
    outputFile = open('filename.txt','w')                   # Create and open text file
    start = chr(startNode +65)                              # Converts the int to its respective Char
    end = chr(endNode +65)                                  # Converts the int to its respective Char
    outputFile.write('Route Start Node: ' + start + '\n')   # e.g Route Start Node: B
    outputFile.write('Route end node: ' +  end + '\n')      # e.g Route End Node: F
    outputFile.write('Route: ' + Path + '\n')               # e.g Path: B,A,D,F
    outputFile.write('Total distance: ' + Distance)         # e.g Total Distance: 4
    outputFile.close                                        # Close file


if __name__ == "__main__":
    function1()
    function3(function2())
    createFile( # Don't Know What Goes Here  )
</code></pre>

<p>At the moment I am only able to run this function by manually calling it and entering <code>createFile(1,5)</code> where the 1 is the startNode value and the 5 is the endNode value</p>

<p>But if I am to put <code>createFile(startNode, endNode)</code> in the <code>if</code> statement to call the function, it tells me <code>NameError: name 'startNode' is not defined</code> and then it would obviously give me the same error for endNode too</p>

<p>How do I call that function properly without having to enter the values manually because they can change depending on what the startNode and endNode values are at the start of the program?</p>
