Reputation: 2217
I'm asking this because I couldn't find any precise answer for my problem. I need to import a python script from another location into my current location.
Here's the directory structure :
C:\Users\dhi\workspace\BasicRegression\Create&&Bkp-Inputs\create&&bkp.py <-- Needs to Import C:\Users\dhiw\workspace\basics\Login.py <-- Needs to be Imported by create&&bkp.py
What line should be included in "create&&bkp.py" to Import "Login.py" ?
basics,Create&&Bkp-Inputs are Folders.
Upvotes: 0
Views: 74
Reputation: 1580
Python looks for modules along the PYTHONPATH
, which you can append to relatively easily.
import sys
sys.path.append("C:\\Users\\dhiw\\workspace\\basics\\")
import Login
Upvotes: 2