1

I'm starting to create lots of python scripts. These scripts are made to run on a number of files from the same folder the script is in. I want to store this script in an organized folder, and be able to access the script from any folder I navigate to in the console. How do I do this?

Thanks!

Edit: this is what I wanted to do, How to import custom python package by name

squirrely
  • 29
  • 1
  • 6

2 Answers2

0

I think you can use something like this to access you scripts from anywhere:

>> python [path]\script.py
John Howard
  • 61,037
  • 23
  • 50
  • 66
usamazf
  • 3,195
  • 4
  • 22
  • 40
-2

This is OS dependent. In windows it requires a .bat file in your path that invokes the python script from the folder where you're storing them. In linux you can copy the scripts to /usr/bin.

Keith Brodie
  • 657
  • 3
  • 17
  • So I can store all of my "in-house" python scripts in /usr/bin and python will know to look here first? – squirrely Feb 03 '16 at 06:49
  • Not python - the shell will look there. In linux you can mark a python script as executable - then the shell will find it there and execute it. The first line of your python script should read: #!/usr/bin/python - which tells the shell to use python when processing it. – Keith Brodie Feb 03 '16 at 06:54