0

First my folder structure(didn't show some of the unnecessary files or folders):

pythonLeaning
  |Debug
  |PythonLearning
     |Library
     |  |cameo.py
     |  |managers.py
     |
     |SciPy_etc
        |OpenCV.py

In the cameo.py, I have:

from managers import WindowManager, CaptureManager

And it works well. But if I import these 2 file in OpenCV.py:

import managers
import cameo

I'll get this:

Traceback (most recent call last):
  File "C:\Amarth\Computer_Graphics\Programing\PythonLearning\PythonLearning\SciPy_etc\OpenCV.py", line 7, in <module>
    import managers
ImportError: No module named 'managers'

Visual Studio doesn't show any real-time error in the window, like red underline or something. And it can auto-complete the class or function name in managers and cameo, in which case I thinks indicates the success of the import .

Then what's the problem?

================Update 1=================

I thought I don't need managers.py since it is only used in cameo.py, so I deleted import managers, only left import cameo, now I get this:

Traceback (most recent call last):
  File "C:\Amarth\Computer_Graphics\Programing\PythonLearning\PythonLearning\SciPy_etc\OpenCV.py", line 8, in <module>
    import cameo
ImportError: No module named 'cameo'
Amarth Gûl
  • 1,040
  • 2
  • 14
  • 33
  • 1
    Python imports from the root of the structure (top down) try: from PythonLearning.Library import cameo – martinB0103 Jul 21 '17 at 15:36
  • 1
    @martinB0103: I was posting the same comment :). Anyway, [here](https://stackoverflow.com/questions/9383014/cant-import-my-own-modules-in-python) a similar question – gionni Jul 21 '17 at 15:38
  • @gionni Its one I have answered recently.....maybe this https://stackoverflow.com/questions/45066129/python-module-not-found-issues-after-moving-directory/45066316?noredirect=1#comment77106277_45066316 – martinB0103 Jul 21 '17 at 15:39
  • @gionni solved, Thanks! – Amarth Gûl Jul 22 '17 at 13:11

0 Answers0