I am trying to decompose my program on python
. I have read a lot of information and other answers about how import
works, but still cant understand how exactly.
I want to use my module Graph.Graph2D
for implementation in InteractiveGraph2D
. Before importing it, I add path to this module. But it tells NameError: name 'Graph2D' is not defined
.
Project path:
~/MyData/Python/Pygame/RoadSearchAlgorithm/src
Module path:
~/MyData/Python/Pygame/MY_MODULES/Graph
Code:
# ~/MyData/Python/Pygame/RoadSearchAlgorithm/src/Graph_package/InteractiveGraph2D.py
...
sys.path.append('./')
sys.path.append('/home/rayxxx/MyData/Python/MY_MODULES')
try:
from Graph.Graph2D import Graph2D, ...
...
except Exception as e:
assert (e)
class InteractiveGraph2D(Graph2D):
...
What's the problem?
I tried to look at paths, list of imported modules. The Graph module presented in it.