Basically, you need to pass a parameter to your function that will allow you to pick the tile in the function itself (possibly the UID of the tile).
From there, the picking can be several things (an instance variable, the IID, the UID, a position...) it just depends on your project.
The thing to remember is that a function called does not remember the previously picked instances.
For example, if you call a function inside a "On touched object" event, the touched instance won't be passed into the function automatically.
This is something you have to do yourself.