Q:

How can I know from which directive is called a function that is defined on the $rootScope?

I have multiple directives and in every directive I call a function which is defined on the $rootScope. I want to find a way to tell from which directive the function was called without sending the directive name.

A:

You can try to extract the caller function from within the $rootScope function you are using.
e.g.
arguments.callee.caller.toString();

There are many example to get such data or stack-traces, just try to look for that.

