I have a config.py file which has a list of constants, such as:
config.py
NAME = 'John'
AGE = 23
In another file, I import this file as a module and then pass it as a parameter to other functions. I used ModuleType as the type for this parameter.
import config
from types import ModuleType
def f1(config: ModuleType) -> None:
print(config.NAME)
The problem is when I run pyright linter, it reports an error:
79:30 - error: Cannot access member "NAME" for type "ModuleType"
Member "NAME" is unknown (reportGeneralTypeIssues)
What's the correct way to type hint the config to avoid these errors? Thank you!