I am using some code which uses Sanic as a webserver. How can one get access to the instance of the object that was initialized somewhere else in the code.

def someinit():
app = Sanic(‘val’)

Is there anything in Sanic that can provide access to the instance of “app” in a different scope ? Basically is there a handle to "Sanic instance initialized above that can be accessed in a global way?

It is available as a param in Middleware, or an attribute on therequest object.

Usually one of the easiest things is also just to import it.

from import app