"Go to definition" doesn't work with "from X import *" declarations
Brought to you by:
fabioz
I think I have finally found a hint on why "go to definition" works for some people and not for others.
It has to do with "star" imports.
Suppose you have module M1 and module M2 which has symbol S2
m1/ m1/__init__.py m1/m2/__init__.py from s2 import * m1/m2/s2.py class S2(): pass
Then we can import it in two ways:
1) from m1.m2.s2 import S2
2) from m1.m2 import S2
They both work, but (2) doesn't make "go to definition" work properly.
One fix is to use an explicit import instead of the "star":
m1/ m1/__init__.py m1/m2/__init__.py from s2 import S2 # <~------ m1/m2/s2.py class S2(): pass
If this is done then both (1) and (2) make "go to definition" work properly.