0

Dear All,

Hello,

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.

i.e, YYY is colection of py files { y1.py, y2.py,....}, that are imported to A.py.
I mean that in A.py file we have this:

import XXX.y1 as Y1
Y1.doSomething1()
import XXX.y2 as Y2
Y2.doSomething2()

... and so,

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().

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:

import XXX.y1 as Y1
Y1.doSomething1()
import XXX.y2 as Y2
Y2.doSomething2()
import XXX.ZZZ as Z
Z.doSomething()

I got this error "python import error no module named XXX/ZZZ.py"
Python can not import ZZZ!
I wounder what is the difference between ZZZ.py and y1.py or y2.py,....

Why python can import XXX/YYY py files but returns this error for ZZZ.py?

Anybody could help me?

Thanks in advance.

Edited by pooya083: n/a

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by pooya083
0

OOOOOOOh! what a big mistake! I found it, Python import files from other directory! my example project install itself in the other path and i forgot about it!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.