Reduced example of the issue:
defs.py:
def __pragma__(arg: str) -> None:
pass
__all__ = ["__pragma__"]
main.py:
from defs import *
__pragma__('main')
print('hi')
The current mypy behavior differs as follows:
$ python main.py
hi
$ mypy main.py
main.py:3: error: Name '__pragma__' is not defined
This is an most likely an obscure case, but if it could be added to mypy I would greatly appreciate it that would be greatly appreciated. I can also write a pull request to implement this, if it's deemed worth adding.
My use case for this is providing stubs for 'meta' functions provided by transcrypt, a Python transpiler/pre-processor. Transcrypt provides __pragma__ and __new__ to control / augment the transpilation. Having import * from defs work to import both these transcrypt-builtins and all other transpilation-builtin types would greatly increase usability of mypy and transcrypt together.