Accessing components inside a template repeater

Hi, I am using a template repeater to display one of my longer main windows (as it gives me scroll bars instead of resizing my components) but now I am having trouble accessing the power table component inside the template repeater. I looked on the forum and found an old post.
It suggested following:

templateRepeater = event.source.parent.getComponent('Template Repeater')
templates = templateRepeater.getLoadedTemplates()
template = templates[0]
power_table = template.getComponent('Power Table')

But now I am getting this error, “IndexError: index out of range: 0”

I am still a newbie, any kind of help is appreciated, Thanks!!

Try not to use index; if you could get the Components directly from a FOR statement:
for temp in templates: