parent path module imoport

Created
Created
2020 Feb 28 6:9
Tags
Tags

function

import inspect from sys import path from os.path import abspath, dirname currentdir = dirname(abspath(inspect.getfile(inspect.currentframe()))) parentdir = dirname(currentdir) path.insert(0, parentdir) from conf.value import OK, ERROR
 
 
 
Importing modules from parent folder
I posted a similar answer also to the question regarding imports from sibling packages. You can see it here. The following is tested with Python 3.6.5, (Anaconda, conda 4.5.1), Windows 10 machine. I assume the same folder structure as in the question .
Importing modules from parent folder
 
 

Recommendations