Is it possible to call a method once per frame inside of another method?

I’m working with live video processing.

My problem is that I want to call a method and inside this method I want to have a loop that runs every frame just like Update() but after a defined time I want to break the loop and return something.

I know that there is a while loop but as far as I know, this loop does everything in just one frame and that’s not quite what I’m searching for.

Does anybody have a solution? I added a small example (not real code) to clarify what I mean.

public void DetectFace()
        int detectedFaces = 0;
        Vector2 nosePos;

        //loop that calls once a frame, I used while for demonstration
        while (detectedFaces < 10)
            if (FindFace())
                nosePos = GetNosePos();
                detectedFaces = 0;

        return nosePos;

You can use Invoke() to invoke a method after a cerain time that you specify.

Why not just use a public bool to disable it? it could be inside a for loop in Update or maybe a coroutine with a while loop using that bool as condition.