If I write this code:
import math
math.abcdef()
where clearly the method abcdef()
does not exist in the imported math
module, why doesn't visual studio code show an error?
Is there a way to force vscode to check that the called method exists in the imported module?
Such error messages in vscode are generally provided by linting.
You can enable linting in settings. The error messages obtained by selecting different linter are not exactly the same.
If you don't want use linting, change the python.analysis.typeCheckingMode option in the settings to basic
or strict
.
At this point, the Python extension prompts an error message.