Question: I'm trying to create a list of dictionaries in Python.

```
send_this = []

fruits = {'a': 'apricot', 'b': 'bagel', 'c': 'carrot'}
template = {'a': 'apple', 'b': 'banana', 'c': 'coconut'}
for i in fruits.keys():
    send_this.append(template[i] = fruits[i])

```

This updates `template` and adds it to `send_this` but every iteration updates all the values stored in `send_this` instead of just adding a unique one.

I want the final result to be different dicts inside the list i.e

```
[{'a': 'apple', 'b': 'banana', 'c': 'coconut'}, {'a': 'apricot', 'b': 'bagel', 'c': 'carrot'}]

```

but what I'm getting is something like this

```
[{'a': 'apricot', 'b': 'bagel', 'c': 'carrot'}, {'a': 'apricot', 'b': 'bagel', 'c': 'carrot'}]

```

I'm trying not to create the dictionary on the fly for each iteration since the vast majority of the dictionary doesn't need to change for the whole loop.

Answer: 
You're using foreach with `GetComponentInChildren<Hotbarbuttun>()`.

The Get Component SINGULAR will only return one item, so where you think you're iterating over a collection of `Hotbarbuttun` you're actually trying to iterate on a `Hotbarbuttun`, which itself is not a collection. It doesn't implement GetEnumerator, again because it's not a collection, so you can't do that.

What you're looking for instead is the PLURAL `GetComponentsInChildren<Hotbarbutton>()` which will return an array of `Hotbarbutton`.
You are calling a method that returns a single component which cannot be enumerated.

From the [documentation](https://docs.unity3d.com/ScriptReference/Component.GetComponentInChildren.html):

```
public Component GetComponentInChildren(Type t);

Returns
A Component of the matching type, otherwise null if no Component is found.

```

What you want instead is to call a method that returns an [enumeration](https://docs.unity3d.com/ScriptReference/Component.GetComponents.html), such as:

```
public Component[] GetComponents(Type type);

Returns 
all components of Type type in the GameObject.

```

In your code:

```
foreach(var Button in GetComponents<Hotbarbuttun>())
{
    Button.OnbuttonClicked += ButtonOnButtonClicked;
}

```