In a Python script, how to change to the directory containing that script? Mar 15, 2020 Code snippet below: import os tmp = os.path.abspath(__file__) tmp = os.path.dirname(tmp) os.chdir(tmp)