What flow design would be the best to use when using with Telegram bot?

I thought about one python script that runs DepthAI with a while loop, retrieving frames and processing them + another python script to handle the Telegram bot.
Another option is using a single python app that uses both depthAI and Telegram bot, but uses two threads for the two processes.

I need to create some communication between the telegram bot callbacks and the OAK1's detections from the cam.

Instead of a while loop, can I just trigger the "tryGet()" method to receive the frames whenever the telegram bot triggers it?

The problem is, when 100 users ask to get a package of detections from the same camera at the same time, there's no point in calling:
with dai.device(pipline) as …
# tryGet() to get a frame
# process the image

about 100 times.

It's better to let 100 users get the same recent result that has been saved in some queue, to spare the redundant computing over again and again. On the other hand, it means that the OAK continues processing every frame for hours, even if there are periods of no requests.

    lerp
    Then you might be better off using a still capture based on a GET request. Basically, each time a user asks for a result, you can make a call to the device to trigger a still image capture. That image is then processed and returned to the host queue. Between these triggers, the camera does not run processing.
    This way each user gets his separate processed image, but this might take a bit longer then just polling the queue from a constantly streaming camera.

    Depending on the processing, expect the response time to be 60-200ms per request.

    EDIT: example here - should be similar to what you do but instead of triggering from the Script node,you trigger from the host.

    Thanks,
    Jaka