I an writing a Python package. The index like bellow
main.py
pkg
|--utils.py
|--files
|--1.txt
|--2.txt
I write a function to load the file 1.txt
in the utils.py
using relative path. And it works in the utils.py
, but fail when I call the function in the main.py
.
I konw the reason is the relative path has changed. I want to know how to solve it with not change the relative path.
Another problems is how to add the file to the python package when upload to the pipy.