How to get the directory path of a Python 3 script from within itself
One of the best way to reference files in Python scripts is to based the file path on the directory where the Python script resides in. This will allow us to always reference our files correctly no matter where our Python script is being executed.
This post documents the Python 3 code that I often used to get the directory path of a Python 3 script from within itself.
Follow us