The wait is messing it up in this case. What it's doing is pushing the function call to the end of the event sheet, and what you want is the call done in place.
When creating a new object this defines when it can be picked:
"pick by uid" is the exception as it works for any object that was created.
For accessing new object's immediately from a function you should pass that object's uid. Then you can pick the object by uid in the function, and reverse it to pick a sprite from the sprite2.
call "hasframechanged" (sprite2.uid)
on function "hasframechanged"
sprite2: pick with uid function.param(0)
sprite: pick closest to (sprite2.x, sprite2.y)
sprite: x = sprite2.x
sprite.y = sprite2.y
--- sprite: set ischanged to true
The newly created object is added to the object list at the next toplevel event as per the links above.