How to access a module from outside your file folder in Python? [duplicate]

The simplest way is to modify the sys.path variable (it defines the import search path):

# Bring your packages onto the path
import sys, os
sys.path.append(os.path.abspath(os.path.join('..', 'config')))

# Now do your import
from config.config import *

Leave a Comment