Search code examples
pythonsystempythonpathsystem-variable

Custom python module seen in C: but not in D:


I have a module that I want to be able to import from any script without doing any sys.add_path and similar stuff. I want it to be permanently added.

Since I installed Python with anaconda, I have a anaconda3 folder added to Path under System variables. In the same place I added C:\Users\lukas\anaconda3\package and in the package folder is my script with empty init.py, and the script.py which contains functions.

In the Path under User variables, I already had anaconda3 folder, and I added the \anaconda3\package. Also, I created the PYTHONPATH variable under User variables and added anaconda3 and \anaconda3\package.

When I open my CMD, that is working in C drive, it can import the package successfully. But, when I open the CMD in D drive(in my VS code) it is not working, can't import the package.

As you can see, I've tried everything I saw on the internet, and probably now I have much more junk than needed added paths.

How should I clean this up and make it work on every drive?


Solution

  • For anyone that is interested, after several hours, I tried again(by accident) and everything works :) It seems like Win10 needed some time to really update the environment variables.