Python programs are set to get faster startup times with PEP 810 "Explicit lazy imports," which allows scripts to defer loading imported libraries until they're actually needed rather than at startup.
Starting a Python application typically results in a flurry of imports as modules from various locations (and the modules they import) get added into the application process. All of that occurs before ...
Python 3.15 has introduced a feature to allow "lazy" module imports, where an imported module isn't actually evaluated until the first time it's used. For modules that take a long time to initialize ...
Or, on the assumption that you're willing to do work to support lazy loading, you move all of the global code bar imports into the init function, and then have the last line of your module be init().