SangeetNenwani
12 months agoContributor
Use of Local Variables in Python Framework
I am utilizing local variables in the script. In the past, I employed the same method with the c# framework, and it functioned well. However, now that I am using the python framework, when I use a local variable, it behaves like a constant. I can't modify it in one function and use its modified value in second function. I prefer not to define global variable, as this approach of using local variable in multiple places would lead to an increase in global variables
Does someone know a solution for it?
Arguments are passed by assignment in Python. Although cumbersome, you can workaround this via,
def test1(x): x = x + 1 return x def test2(): x = 1 Log.Message(x) Log.Message(test1(x)) # Workaround
Python documentation will have more information on this.