Skip to content
Advertisement

Tag: typer

How to resolve mutual dependencies between a main script and submodules needing access to a global variable from the script?

I’m building a Typer app with lots of commands. I want to categorize the commands into subfiles but am unsure how to resolve the dependencies. main.py is the parent. It looks like this: So, we make a new Typer app and import everything from the submodules. Simple enough. Each of the submodules contains Typer commands, like booklist: Here’s the problem:

Advertisement