Running from Flask

After going through some posts I have found that from pynq import Overlay this will only work with root privilege. I have succeeded also.

But I have to run a function that depends on this library and I have to run that function using Flask(I need a continuous update from that function). I have run sudo python3 but it fails to access that function.

Is there any workaround to run python code/function which depends on Overlay from another python code like here I am trying using Flask?