When an attribute is created and hinted, and then used in the same method, the autocomplete doesn't work (only shows python object stuff):
But if I try to use the attribute inside another method, the autocomplete works and show all the specific class stuff:
While inside the same method, Pylance can actually see that the variable is None
because you set it in the last line so it ignores the type hint. Inside a different method, Pylance can no longer count on the variable being None
so it goes with the type hint and treats it as a ndarray.
However, if you define it as a proper ndarray in the function, Pylance will autofill correctly as you can see here