Righto. Thanks very much for your help - much appreciated.

On Friday, 2 October 2020 at 9:04:33 pm UTC+1 bwoodsend wrote:

> Because import mypkg.mymod initialises it but --hidden-import=mypkg.mymod 
> just says include it. Python doesn’t automatically import modules just 
> because they exist otherwise it would be incredibly slow.
>
> If you really don’t want to use from . import mymod then you can put the 
> following in your __init__.py (note Python>=3.6 only) but it’s terrible 
> programming practice.
>
> def __getattr__(submodule):
>     import importlib
>     try:
>         return importlib.import_module("mypkg." + submodule)
>     except ImportError:
>         raise AttributeError(submodule) 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/34cc2a98-a486-4b5e-8381-406718dc0fe4n%40googlegroups.com.

Reply via email to