0

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.

Dhiwakar Ravikumar
  • 1,983
  • 2
  • 21
  • 36

1 Answers1

2

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
gcarvelli
  • 1,580
  • 1
  • 10
  • 15