# Iterate through all components programatically in Perspective?

**URL:** <https://forum.inductiveautomation.com/t/iterate-through-all-components-programatically-in-perspective/32938>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [March 9, 2020, 7:39pm UTC](https://forum.inductiveautomation.com/t/iterate-through-all-components-programatically-in-perspective/32938 "2020-03-09T19:39:52Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [December 4, 2023, 5:44pm UTC](https://forum.inductiveautomation.com/t/iterate-through-all-components-programatically-in-perspective/32938/21 "2023-12-04T17:44:18Z")

</div>

We went with this one so our `util` library looks like

```auto
def getComponents(element):
	def walkComponents(component):
		for child in component.children:
			yield child
			walkComponents(child)
	return walkComponents(element)

def parseContainer(container):
	return {
		c.name: c.custom["outValue"]
		for c in getComponents(container) if "outValue" in c.custom
	}

```

and call parseContainer on a container works as we expect it too.

Decided on this one because it's the most readable to me and without needing a library.

Thank you all very much!

---

_[View the full topic](https://forum.inductiveautomation.com/t/iterate-through-all-components-programatically-in-perspective/32938)._
