To be efficient a function should be deterministic, i.e. the output should only be depending on the input, so that the result can be cached.
If you want to call a stored procedure from a function, yout have to specifically make the function non-deterministic.