Forum Discussion

SangeetNenwani's avatar
SangeetNenwani
Contributor
2 years ago
Solved

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 lo...
  • rraghvani's avatar
    rraghvani
    2 years ago

    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.