set_global_app#

toui.apps.set_global_app(app)[source]#

Allows the app object to be shared across Python modules.

Examples

Suppose you have two Python scripts, “main.py” and “home_page.py”. In “main.py”, you can create the app and make it global:

>>> from toui import Website, set_global_app
>>> app = Website(__name__)
>>> set_global_app(app)

While in “home_page.py”, you can get the shared app:

>>> from toui import get_global_app
>>> app = get_global_app()