If you require separate global variables for multiple instances of a routine, you can use Frames.   See SpriteMeshEd(), 
::/Demo/Graphics/Pick3D.ZC or Noise().