I've scoured through and found lots of questions with lots of answers but nothing seems to be hitting the mark.
I've set up two files config.py
and test.py
under one folder called test.
config includes the code:
class Config:
def __init__(self, name):
self.name = name
while test has:
try:
# Trying to find module in the parent package
from . import config
print(config.debug)
del config
except ImportError:
print('Relative import failed')
try:
# Trying to find module on sys.path
import config
print(config.debug)
except ModuleNotFoundError:
print('Absolute import failed')
This has been put together as per the answer supplier on this stack answer.
Unfortunately I'm getting both errors appearing, when I just try to directly call it from config import Config
I get ModuleNotFoundError
I'm truly lost on this one and can't figure out where to go from here.
Using Python 3.6, atom.io as my IDE.