Before this is marked as duplicate please read the full problem.
So I have a folder structure like this:
main.py
|
|_one
|_ one.py
|_ file.txt
What i'm doing is, importing one.py into main.py and calling a function. My py files are,
main.py
import one
one.f1('test')
one.py
def f1(param):
with open("file.txt", "r") as f:
print(f+param)
When I run main.py, I keep getting this error : FileNotFoundError: [Errno 2] No such file or directory: 'file.txt'.
I have also tries os.path.abspath()
but still no luck. Am I doing something wrong?
Thank you!