I’m having trouble passing variables between Python scripts. In my minimal working example, I group variables into a dictionary and pass it on to the next script. However, when it arrives, the datatype has changed to a string.
I attempted to use type hints, but dictionaries are not available. Previously, As a workaround I used the json module to pass the variable as a string through dumps() and reads(), but this method only works if the data is json-serializable, which is not always the case.
I would assume so. Note that this tuple wrapping hack is used to work around the fact that a “dictionary that is passed as output from a component will be seen as enumerable … This means that only the keys will be resolved” i.e. only the keys are output:
And that one may also structure the data in a class (see the example by Giulio in the first link), which for other cases may be more appropriate (e.g. cases where you’re already working with classes and not dictionaries). Also note that one can pass lists of dicts/classes if one sets the receiving component parameter access to List Access.