3

I have my own module named v_systems, and I'm trying to import that module in another python file (which is also saved in the same directory as the file v_systems is saved) I need to import it as import v_systems as vs or even if I try to import as import v_systems.

However it gives me an error saying no module v_systems exists.

How may I fix this error?

rypel
  • 4,686
  • 2
  • 25
  • 36

1 Answers1

1

It might not be in the system path. Do the following:

It needs to be in the directory of the sys.path. What I did is I created a folder (doesn't really matter where) called "Modules" in which I have all of my modules that I download/create in there. Say I put it in C:\Users\USER\Modules. You can put this module in there as well.

You need to copy the path to the folder.

Then, go to Control Panel. Click System, then on the left panel there is an option called "Advanced System Settings". Click that. From the bottom of the window that pops up, click "Environment Variables". Look to see if you have a variable created called PYTHONPATH. Most likely, you don't. So, create a variable (in the second section) by pressing "NEW". Name it PYTHONPATH and for the Variable value, put in the file path. (For my example, the file path is C:\Users\USER\Modules). Hope this helps :)

I inserted a screenshot of how to get there once you get to the System (Properties) location in Control Panel: Python Path

Rushy Panchal
  • 16,979
  • 16
  • 61
  • 94