Loop the OUT (OUT for output port)

Hi there,

I am currently trying to feed a item of a list with multiple items to this pipeline that I have created in dynamo, and for that, I am trying to loop over the items in the list using “Python Script node”. I need that for each iteration, a list is sent to the output port and the following dynamo nodes to be executed. So far, unsuccessfully, though.

The last but one item is being sent to the pipeline with the script I have below. However, if I iterate through the list manually by changing the index (list[index]), it works fine. But when using the for loop, it doesn’t work.

See my approach below.

list_of_all_dicts = IN[0]

counter = 0
for list_of_dicts in list_of_all_dicts:
	OUT = list_of_all_dicts[counter]
	counter += 1

Maybe there is an easy workaround for this. Open to any suggestions.


OUT is the variable for the defined output port and you only get one. You’re just setting the OUT variable each time in the loop while still returning the output only once. You just need to define a list and then return that list in the output OUT.

list_of_all_dicts = IN[0]
myOutput = []

counter = 0
for list_of_dicts in list_of_all_dicts:
	counter += 1

OUT = myOutput

Adding on to what @Nick_Boyts said, you can always separate the OUT of the python node later on using a codeblock.

Hi there

Thanks for the feedback, but I already have the entire list set in list_of_all_dicts. So everything I need is already there, so I am not trying to append anything to it. What I am actually trying to do is the opposite which is breaking it down into the OUT variable one item at a time. The problem is that my list is very big, and need to break it down in an efficient way, otherwise, I would have to use some sort of GetItemAtIndex node hundred times.

So there is no way to use the OUT for iteration?
Another thing I am trying is to somehow combine the GetItemAtInded with the node LoopWhile. Does that make sense or I am being delusional?

Much appreciated for your time.

Hi there

Thanks for the feedback. Please see my previous comments.
Is there a way to iterate through the variable python (e.g., out = python[i]) and send that info to the Watch node repeatedly?

My list has hundreds of sublists :face_with_peeking_eye:

This is not possible. As I mentioned, OUT is a singular output. It can be any dimension list or a singleton, but the python node itself only has one output port.

This sounds like a misunderstanding of Dynamo handles lists. Dynamo will automatically loop through lists. If you need to handle lists individually then they need to be individual items, not a list. Typically the better workaround is to make your logic work for a list of lists, rather than breaking sublists into single lists with their own node branch.

If you give us more information and explain what you’re actually trying to do we could probably give you some suggestions.


I have done some work using a list of lists and it worked perfectly.

But this time, I have an issue because, for each of the sublists in my list, I need to create a polygon and then create a solid by sweep. If I use all the points in my list, the polygon will not make sense since I will not be able to control the shape created by Polygon.ByPoints and sweep will subsequently fail as well.

But I am realizing now (as I am writing this) that the issue here is that I was expecting to use that for loop that I was trying to do, so I set my list thinking that way. I’ll rethink it and restructure my lists. Thanks :100: