Example tested works.
Data.txt:
Also running code from shortcut the window will disapred fast,so add
Data.txt:
Output:42
# meow.py with open(r'G:\div_code\PyProj\Assets\Data.txt') as f: print(f.read()) input('Press any key to quit')
Output:42
So giving absolute path to Data.txt
and other option is the package way with importlib.resources Also running code from shortcut the window will disapred fast,so add
input()
to stop it so can se result.