How to get directory of current Python script

import os 
script_directory = os.path.dirname(os.path.realpath(__file__))

This will always get the directory of the .py file running that code, so if you have .py files in a subdirectory/module this might return that subdirectory.

Original (partial) source for the solution: StackOverflow