python refer to path of file in same directory code example
Example: python open file same folder
import os
with open(os.path.join(sys.path[0], "my_file.txt"), "r") as f:
print(f.read())
import os
with open(os.path.join(sys.path[0], "my_file.txt"), "r") as f:
print(f.read())