**Question:**

I need to find a way to preload my .png files, because at some points of my code, graphics that should be buttons appear as black squares while at other points (exactly same code) they work perfectly.
I thougt of doing that in a python class at startup, and attach them later in my .kv files.
The crux is, that I use `source:` and "preloading" a string like `'assets/graphics/buttons/newImg.png'`would store the string, not the image. And if I load the image another way, I don't know how to attach that later to my buttons.

Any hints and/or ideas are appreciated!

**Background:**

I created my buttons like this:

```
<MyButton@ButtonBehavior+Image>
    widgetTarget: ''
    source: 'assets/graphics/buttons/' + self.widgetTarget + '.png'
    on_press:
        self.source = 'assets/graphics/buttons/' + self.widgetTarget + '_clicked.png'
    on_release:
        self.source = 'assets/graphics/buttons/' + self.widgetTarget + '.png'

```

and use it like that in my .kv files:

```
CustomButtonNoTarget:
        id: meIsButton
        widgetTarget: 'stopSign'
        on_release:
           *do stuff here*

```

Most of the time, that works like a charm, but at certain points in the program flow, instead of images only black squares (same size) appear.

Because the exact same code worked at other positions in program flow I focused on the images:
I tested:
different images - different image types - different image sizes

-> all results exactly the same.

Then I stumbled over a hint: If I used the same graphic BEFORE the problematic position, it's loaded perfectly later on. So I think the problem is that - why so ever that happens at just few positions and not all the time - the image can't be loaded fast enought. Because RAM is faster it works, when the image allready is in RAM.

So my idea to solve that would be to store all images in memory at startup, what leads me to obove asked question.