I have seen this asked on many many times on stack exchange but even when try all the solutions I am not able to get it to work. I have a module in python called functions.py. I have another script called main.py. I am running visual studio code.
When i try to run the code below I get the error
# Import the customs functions bit
# functions.py is stored in the scripts folder of the project
sys.path.append(os.path.dirname(os.path.abspath("C:/project/scripts/")))
import functions as hlp
>>> ModuleNotFoundError: No module named 'functions'
If i switch to Spyder, I try the following code which does work. However the marked line is specific to Spyder.
I want the code to be able to run on any IDE. If you are familiar with R, the runfile function effectively sources the file so all the functions in functions.py are available in the envoirnment.
# Import the customs functions bit
# Source the functions file
runfile('C:/project/scripts/functions.py', wdir='C:/project/scripts/')
import functions as hlp
Any help would make my day
Thanks