How know Who Is calling sub or function

While it is possible to inspect the stack and thus the calling chain, an arguably cleaner approach would be to pass everything the called method needs in a parameter. In whichever way the identity of the caller might be relevant there is a way to capture that information in an additional parameter. Chances are this would also be more efficient.

6 Likes