restart; expr := 3*sin(z)+t+3*f(z,t,y)*t+g(x,t); res := indets(expr, patfunc(identical(z), anything)); if numelems(res)<>0 then print("Found these functions",res); else print("could not find any function)"); fi;
gives
"Found these functions", f(z, t, y), sin(z)