0

i have the following directory structure

dira/
    __init__.py
    a.py
    b.py
    dirc/
        __init__.py
        c.py

I need to import b.py in c.py and import c.py in a.py

a.py :-

from dirc.c import *

This is not working it is giving the error:-

Unable to import 'dirc.c  'pylint(import-error)'

c.py :-

from dira.b import *

This is giving the error:-

ModuleNotFoundError: No module named 'dira'

I don't know why the imports not working, what's the issue? i tried the suggested answer:-

c.py:-

from ..b import *

error:-

ValueError: attempted relative import beyond top-level package
HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
rahul Kushwaha
  • 2,395
  • 7
  • 32
  • 64
  • Does this answer your question? [Can't import my own modules in Python](https://stackoverflow.com/questions/9383014/cant-import-my-own-modules-in-python) – Björn Apr 17 '20 at 06:14
  • Maybe [this](https://stackoverflow.com/questions/51592182/how-to-import-my-own-modules-the-elegant-way) also helps – Björn Apr 17 '20 at 06:14

0 Answers0