How does "load" resources work? (Godot 3.2)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By nioaps

1.About load image,texture resources: I have imported all of my *.png inside my project

2.Then inside a *.gd file, i have a for loop. Inside that for loop, i call:
Example: var a = load(“res://item/potion.png”)

So, the detail questions are:

q1: How this load process work?

q2: Does this load method good or bad? In case it contain a lot of resources files (maybe 10k or even 100k resources files)

q3: Does this resources was load one time and cached or keep load again whenever enter that iterate?

:bust_in_silhouette: Reply From: Sween123

Load is not like importing.
Your png files have already been imported into Godot and load simply means to load them in your scenes or code. The files have “.import” at the end. Same for loading a scene and instancing it.
So, “load” is commonly used in Godot.
Using a variable like var a = load("res://item/potion.png"), yes it’s one time. It will be there all the time. (Unless you restart the program, again it’s different from importing)