I am learning python and am currently writing a simple program that has to be divided into functions. My problem is that I have one function that should return strings for four different variables, that then should be used in another function.
This gives an error message since var1 is not defined in the frame of function2. How should this be solved? The illustration is very simplified for clarity, but I could post something more specific if required.
There is a thing called scoping, which basically says that variables declared within a function are local to that function and can't be accessed by anything else. If you need to pass values to a function, use parameters.
This should all be covered by the Python introduction you're probably currently reading -- just read on one or two pages :)