0

Here is the directory structure in my sample project.

maindir
    \
     Dir1
        \
         one.py
        \
         __init__.py

    \ 
     Dir2
        \
         two.py 
        \
         __init__.py

I need to import the module 'two' into file one.py. currently I am doing the following

src = os.path.abspath(os.path.join(
    os.path.dirname(os.path.abspath(__file__)), '..'))
sys.path.append(os.path.abspath(src))

import two

I do not want to specify the src path before importing that module, what other option do I have here, so I can directly import the module two into one.py.

nillu
  • 585
  • 4
  • 15

0 Answers0