I know that os.get_cwd() returns current directory. But problem is that it returns directory where you execute python, not the certain file exists in.
For example, below is the directory structure:
my_test_dir
├── __init__.py
├── main.py
└── test1
    ├── __init__.py
    └── util.py
Let say I insert print(os.get_cwd()) in util.py. And main.py import util. If I run main.py in my_test_dir, then it prints my_test_dir, not my_test_dir/test1 because I execute this python program in my_test_dir.
What I want to do is to make it print my_test_dir/test1. 
Is there any way to do that?
 
     
    