What is the best way to port result/value from one script to another?

So I have been developing a plugin suite composed of 4 plugins which can be described as different step to obtain the final result.

Basically the user run the first script (Step1), enter the required values and do some modeling and then run the second script(Step2) that get the value entered in step 1 + the new value the user enter. And it’s the same for step 3 and step 4.

I suppose some people have already coded something like this and would like to know what’s your technique to transition the different value and result between the steps?

Personally I have been using two methods, each one has its benefit and disadvantage, maybe someone have a better solution:
-writing to text file and reading from it afterwards
-using” rs.SetDocumentData() “and “rs.GetDocumentData()”

Hi Medo,

There are a few topics on this issue.
In case of python, currently the best method is to use sticky dictionary:

import scriptcontext as sc

# first script
value = "testing"
sc.sticky["someKey"] = value

# call it from second script
value2 = sc.sticky["someKey"]
print value2

Unlike rs.SetDocumentData and rs.GetDocumentData, sticky dictionary will accept anything for it’s value: string, number, geometry, class…
But looks like in your case (if I understood you correctly, you are trying to “catch” numbers user used), both rs.SetDocumentData and rs.GetDocumentData would do the job too.

1 Like

Hi Djordje,

Thanks mate this look very interesting :smile: yeah for now I’m only using float and string but sticky dictionary seems to be more appropriate for future development !

David and djordje,

many thanks for you support. Both methods are very helpful for me.