from pathlib import Path
Path(Path.cwd()).parent
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import mymodule
OR
import os, sys
sys.path.insert(1, os.getcwd())
import variables
from pathlib import Path
Path('C:Program Files').parent
exec(open(<filename.py>).read())
import os.path
os.path.dirname('C:Program Files')
from pathlib import Path
path = Path(Path.cwd())
print(path.parent)
In [4]: from os.path import dirname
In [5]: dirname('/home/kristina/desire-directory/scripts/script.py')
Out[5]: '/home/kristina/desire-directory/scripts'
In [6]: dirname(dirname('/home/kristina/desire-directory/scripts/script.py'))
Out[6]: '/home/kristina/desire-directory'
from ... import nib
from setuptools import setup, find_packages
setup(name='myproject', version='1.0', packages=find_packages())