Getting this "EXAMPLE" is not a known attribute of module "config" from Pylance (after activating Pylance)
But I don't understand why Pylance is complaining about this. Or what other ways (see below) I could use to fix this.
IDE: VSC
Related code in main py file:
Related code in config.py file:
Contain only a set of variables/settings (with some default(off) value) I generally use in other files/projects.
And nothing else. So no "def class" stuff either.
But the point here is that still would like to use this CFG import for global stuff in the main py file/project. Instead of using "EXAMPLE=123" at root level of the main py file.
+(O yea. Adding " # type: ignore" is not really an option either in my/this case.)
... Please educate me on this.
... Please assume I'm not well versed in code or Pyton terminology.
But I don't understand why Pylance is complaining about this. Or what other ways (see below) I could use to fix this.
IDE: VSC
Related code in main py file:
from sys import path as sys_path sys_path.insert(1, r"<path to py includes>") ## this path is not in the used main.py file-tree. # ... import config as CFG ## from <path to py includes> location. # ... CFG.DEBUG_ANSI = True ## no complains from pylance. CFG.EXAMPLE = 123 ## pylance complaining about it.Tried adding type annotation here. But pylance was not happy about those either. "Type annotation not supported for this statement".
Related code in config.py file:
Contain only a set of variables/settings (with some default(off) value) I generally use in other files/projects.
And nothing else. So no "def class" stuff either.
DEBUG_LEVEL = 0 # ... etc DEBUG_ANSI = False"CFG.EXAMPLE" is not included in the config.py file. I could ofc add it to the config.py file.
But the point here is that still would like to use this CFG import for global stuff in the main py file/project. Instead of using "EXAMPLE=123" at root level of the main py file.
+(O yea. Adding " # type: ignore" is not really an option either in my/this case.)
... Please educate me on this.
... Please assume I'm not well versed in code or Pyton terminology.
