Replies: 1 comment
-
Yes, this is intended behavior. The code above relies on temporal side effects of the Python import loader. In particular, it relies on the fact that when you import In your example above, if you want to access |
Beta Was this translation helpful? Give feedback.
-
I have the following project structure:
I want to access
a.b.c
module inmain
viab.c
(nota.b.c
norc
). So I wrote this code inmain
:This works at runtime, but causes an error in pyright (
"c" is not a known member of module
). And I don't understand why.c
is present inb
not because of a side effect, but because of my explicit import. Is this an intended behavior? And if it is, how should I fix my code to get rid of the error and still being able to accessa.b.c
module by writingb.c
in the main file?pyright 1.1.261
python 3.10
Beta Was this translation helpful? Give feedback.
All reactions