Detect whether one Turing machine invokes another
The notion of "one machine invokes another" is ill-defined. To emphasize the point of @AbdousKamel, let us observe an even trickier example:

function g():
   do_something;


And now:

function f():
   k = 0
   while not "k encodes a proof of Riemann hypothesis":
     k = k + 1
   "simulate the Turing machine encoded by k"


In order to tell whether f "invokes" g, you have to:


Decide whether Riemann hypothesis is provable, and
Calculate whether the smallest k which encodes a proof of Riemann hypothesis also happens to encode a Turing machine whose behavior is equivalent to the behavior of g.


Question: does f invoke g?