<div class="post-text">
<p>Dear All, <br></p><p>Hello, <br></p><p>I am very new at python. I have an existing example project that
have some scripts YYY,in path XXX/YYY
and an script A.py that call these one by one.</p><p>i.e, YYY is colection of py files { y1.py, y2.py,....}, that are imported to A.py. <br>I
mean that in A.py file we have this:<br><br>import XXX.y1 as Y1 <br>Y1.doSomething1()
<br>import XXX.y2 as Y2 <br>Y2.doSomething2()<br><br>... and so,<br><br>
I only want to add an script ZZZ.py to the YYY scripts in the XXX directory, so that call
ZZZ.doSomething() after calling YYY.doSomething(). <br></p><p>Although all y1.py,y2.py,... files in XXX directory are called in the same way, but when I
add new python file in XXX directory, and name it ZZZ.py and change A.py
to this:<br><br>import XXX.y1 as Y1<br> Y1.doSomething1() <br>import
XXX.y2 as Y2 <br>Y2.doSomething2() <br>import XXX.ZZZ as Z <br>Z.doSomething()<br><br>Python
can not import ZZZ. and returns "<br></p><div class="post-text">
<p>Dear All, <br>
</p>
<p>Hello, <br>
</p>
<p>I am very new at python. I have an existing example project that
have some scripts YYY,in path XXX/YYY
and an script A.py that call these one by one.</p>
<p>i.e, YYY is colection of py files { y1.py, y2.py,....}, that are
imported to A.py. <br>
I
mean that in A.py file we have this:<br>
<br>
import XXX.y1 as Y1 <br>
Y1.doSomething1()
<br>
import XXX.y2 as Y2 <br>
Y2.doSomething2()<br>
<br>
... and so,<br>
<br>
I only want to add an script ZZZ.py to the YYY scripts in the XXX
directory, so that call
ZZZ.doSomething() after calling YYY.doSomething(). <br>
</p>
<p>Although all y1.py,y2.py,... files in XXX directory are called in
the same way, but when I
add new python file in XXX directory, named it to ZZZ.py and change
A.py
to this:<br>
<br>
import XXX.y1 as Y1<br>
Y1.doSomething1() <br>
import
XXX.y2 as Y2 <br>
Y2.doSomething2() <br>
import XXX.ZZZ as Z <br>
Z.doSomething()<br>
</p><p>I got this error "python import error no module named
XXX/ZZZ.py"<br>
Python
can not import ZZZ! <br>
I wounder what is the difference between ZZZ.py and y1.py or y2.py,....</p>
<p>Why python can import XXX/YYY py
files but returns this error for ZZZ.py? <br>
</p>
<p>Anybody could help me? <br>
</p>
<p>Thanks in advance.</p>
</div></div>