Sep-30-2019, 08:53 AM
I need to use pass the values in some variables from the "main" script to functions, and also from one function to another function. That seems to work OK when the functions and the main script are in one module. But if I move the functions into a separate module and import that module into the main script, then I get weird error messages (NameError, name is not defined" messages)-type messages. Reading and rereading the python manuals does not provide a solution.
I did read on this forum that many of you recommend NOT to use global variables. I wonder why that is. Is that because using global variables in the correct way is difficult; or is it because some of you have experienced that there are bugs in python that cause that de use of global variables does not always work as decoumented in the manuals? I can, if neccessary, include here some simple "test" programs that show the difficulty.
I did read on this forum that many of you recommend NOT to use global variables. I wonder why that is. Is that because using global variables in the correct way is difficult; or is it because some of you have experienced that there are bugs in python that cause that de use of global variables does not always work as decoumented in the manuals? I can, if neccessary, include here some simple "test" programs that show the difficulty.