Shared function with some output variables

Hi,

I created a shared function in my script library which have some output variable :

An example :

def function(a,b,c):
x=a²
y=a+b
z=a+b*c
return x,y,z

Is it possible to write this ?
How can we use the output variables in a script ?

Thanks,

This works:

def function(a,b,c): x= a**2 y=a+b z=a+b*c return x,y,zBest,

[quote=“flavien”] def myFunction(a,b,c): .... return x,y,zHow can we use the output variables in a script ?[/quote]Although it looks like you are returning multiple values, this syntax really returns a tuple with those values as elements. As a convenience, python allows you to assign to multiple local variables from a tuple, as long as there’s a recipient for every element of the tuple. So, your code can do this:x, y, z = shared.myModule.myFunction(a, b, c)

Thanks for your help which is more simple than the python list solution that I found :

def myFunction(a,b,c):
   x= a²
   y=a+b
   z=a+b*c
return {'return1':x, 'return2':y, 'return3':z}

output=shared.MyModule.MyFunction(4,3,5)

x=output['return1']
y=output['return2']
z=output['return3']