Python script creates folders, how to reference path- absolute vs relative?

Solution 1:

use __file__ to get the path to the python script you are in, regardless of where the script is run from.

from pathlib import Path
script_path_dir = Path(__file__).parent
sub_folder = script_path_dir / 'your_subfolder'