get python script path code example Example 1: python get script path os.getcwd() Example 2: get pyhton file path python import os os.path.realpath(__file__)