import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) path_name = os.path.join(BASE_DIR, 'test.sh') print(path_name)