Yes, it will be called in each iteration, and each input pins. You don’t need to change your approach; just call Get IMG Map
before the loop and save those arrays in local variables. Then, you can use them within the loop.
Technically, in your function, you used multiple find
functions within a map, which means it will be executed each time. This is not optimal.
I have attached a better example to show you how many times it would be running