Skip to content

How to import a module from a different directory in Python?

import sys
# sys.path is a list of absolute path strings
sys.path.append('/path/to/application/app/folder')

import file
See also  Python code snippet - How to downgrade a package ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.