I am working on Python code in python3 that imports several custom libraries. These libraries are located in the file structure. I have no issues with importing these libraries when the code is run from the command window, however pylint is giving me an import-error on all of the custom library imports when I open the files in Visual Studio Code.
I've done a lot of frustrating research into this issue and see that a lot of people have had similar problems. However I couldn't get any of the listed solutions to work but many I didn't understand enough to even try. I have attempted to uninstall and reinstall VScode, pylint, and the python extension itself. I've tried a few things messing with launch.json and settings.json but I've never done anything with json files before and nothing I did seemed to make any difference. I have only one python environment installed. I have tried opening the folder with "File->Open Folder..." instead of using the context window method. The code uses sys.path.append so that the correct directory can be found that has the library and as I've said, this works fine when run from the command window.
Another solution I saw was adding a line
init-hook='import sys; sys.path.append("/path/to/root")'
to a file ~/.pylintrc. I think I've done this and again it didn't solve my issue. However there was little explanation on what this file is, where to find it, or exactly what path it needs. I simply searched for '.pylintrc' in my file explorer and found a file named just that which is where I put the line. The "path to root" I got by navigating to the folder which held all the libraries in sub-folders, then copy/pasted the file path.
Below is an example of how the library is being imported. This works, just not as far as pylint or VScode is concerned.
#Custom libraries
sys.path.append(os.path.join( '../..', 'common', 'appdata'))
import appdata
"Unable to import 'appdata' pylint(import-error)" shows as an error on 'import'
if I try to debug I get the message
"Exception has occurred: ImportError No module named 'appdata'"
I appreciate any help that can be given. Thank you.