Skip to content

Instantly share code, notes, and snippets.

@seanh
Created November 12, 2009 11:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanh/232824 to your computer and use it in GitHub Desktop.
Save seanh/232824 to your computer and use it in GitHub Desktop.
Import a module from a directory (Python)
"""When you want to import a python file but that file is not in the same directory as the python file you're importing from (e.g. it's in a subdir). You need to add the directory that contains the file you want to import to your path environment variable sys.path. sys.path contains all the places python will look for a file when you do an import."""
import sys
sys.path.append('./markdown-1.7')
from markdown import Markdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment