Python ImportError,无法解决

I'm working on an open source Python project and added a new module, to it and was trying to import and use it in another module I had added However, I am running into a ImportError error.

Here is the structure of my project, named opencensus-python:

├── opencensus-python
│   ├── opencensus
│   │   ├── trace
│   │   │    │__
│   │   │    │__ 
│   │   │    │__
│   │   

Here is the code in This runs fine, and I have an import statement in there that I don't use just to prove to myself that importing from that folder did work (so perhaps my file is fine?) enter image description here


enter image description here


Traceback (most recent call last):
     File "", line 2, in <module>
        from opencensus.trace import measure
ImportError: cannot import name 'measure' from 'opencensus.trace' (/Users/anamnavied/Documents/CSC492/opencensus-python/venv/lib/python3.8/site-packages/opencensus/trace/


  1. changed the absolute import statements to relative one: from .measure import Measure but get this error instead ImportError: attempted relative import with no known parent package. I debugged this according to another stack overflow post by adding a shebang to both Python files and running them as an executable script but still get the same ImportError.
  2. I modified the file, since that was what referenced in the error message. This was written by the original developers and contained the code marked #original and I added mine with comments: enter image description here