0

Can someone please help with this error? I have tried all sort of ways to import a module in Python but not has worked so far. I have this directory structure below:

|__folder1:
|      |__folder1a
|          |___inner_file.py
|__outer_file.py

I want to import a Class from the outer_file.py into the inner_file.py. However, I have been getting the error ModuleNotFoundError: No module named.

I have tried all the options in this link on GeeksforGeeks. Thanks.

0

1 Answer 1

3

easy

import sys,os
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.