I have my python files all saved in one directory ('F:\code').
When I enter the Python interpreter from the Windows command prompt :
F:\python
>>>
I can import any .py files created when I entered the interpreter. But I can't import any files created after the interpreter already started. I have to exit the interpreter and then open it again to be able to import any new .py modules.
I have tried:
>>> import sys
>>> sys.path.append('F:/code')
>>> sys.path.append('F://code')
>>> sys.path.append('F:\')
>>> sys.path.append('F:\\')
but get the following:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'module-whatever'
I have tried artificially creating a .pyc file in the pycache folder in the sub of the directory but that doesn't work either.
I'm not sure why I have to exit and re-enter the interpreter because I would like to be able to write .py scripts on the fly eventually and load them in the interpreter to debug.