Pass a robot variable by reference to a python function

Viewed 3069

I use my own python function in Robot Framework. I give 3 parameters, these parameters are Robot Framework variables. When I modify the variables in my function, it is not modified in Robot Framework. So I deduce the variables are passed by value and not by reference... Is there a way to pass the variable by reference ? Or else to return the 3 variables as a result ?

Here is an example of Robot Framework code :

** Settings ***
 Library    OperatingSystem
 Library    myLib.MyLib    WITH NAME    MyLib

 Suite TearDown  teardown
 ** Variables **
 ${var}  azerty

 ** Test Cases **
 My test case
         log     ${var}
         myFunction    ${var}
         log     ${var}

With my python library :

import sys

 class MyLib(object):
     def __init__(self):
         return

     def myFunction(self,var):
         var="another value"

But as I said, the variable var remains "azerty" when I log it, and I would like the second log to print "another value" (as the function should change the value)

Thank for your help !

2 Answers
Related