Make Python find your modules

Make Python find your modules

To reuse your code is very handy if you use this tecnique. You can create a personal folder on your pc with all your scripts and tell Python to search for them with python -m yourfile in any folder you are on your pc, so that you don’t need to have the script in the folder you are in that moment.

  • open the cmd
  • start python
  • import sys
  • print(sys.path)
  • look where the site-packages folder is
  • create a file.path with the folder’s path in it

In the following video there is the explanation of what I just wrote.

Utilities

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.