Closed ronaldoussoren closed 5 years ago
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).
ModuleGraph by default uses the same search path as the running interpreter (that is, sys.path). You can specify a different path when constructing the ModuleGraph instance, see https://modulegraph.readthedocs.io/en/latest/modulegraph.html.
In your case:
g = MG(path=["Test"] + sys.path)
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).
This is not a bug.
Original report by Jack Millist (Bitbucket: Jack, GitHub: Jack).
Suppose we have this directory structure
a
importsb
andb
importsc
. Now fromparent/
we launch the interactive Python 2.7 shell and execute:We get the output
Notice that modulegraph doesn't "see" the import of
c
byb
. Is this intended behavior? If so, how can I correctly analyze modules in a different directory to the CWD (whether using interactive mode or executing a script)?