I have been trying to do a simple import of a Python module and have been running into problems with this simple operation.
I have a directory structure as below:
/home/username/Desktop/project
- src/
- src_a.py
- __init__.py
- bin/
- __init__.py
- app.py
I added /home/username/Desktop/project/src to PYTHONPATH as given below:
export PYTHONPATH="${PYTHONPATH}:/home/username/Desktop/project/src"
in my ~/.bashrc followed by a $ source ~/.bashrc.
I am still not able to get the module to be recognized in app.py nor anywhere else. My editor also does not seem to recognize (autocomplete) the module. I search through multiple related questions and they point to the same procedure. Am I missing something?
bashtag unless you can validate that the bash code really isn't doing what it should. If you runenv | grep PYTHONPATH, is the value you expect shown? If it is, not a bash problem.env | grep PYTHONPATHshows path, went ahead and removedbashtag....thank you :)importline in app.py that isn't working?from src import testfunctionfrom src? then you needprojectto be in your PYTHONPATH, notproject/src, andtestfunctionneeds to be defined insrc/__init__.py.