1import sys
2# sys.path is a list of absolute path strings
3sys.path.append('/path/to/application/app/folder')
4
5import file
1import sys
2# sys.path is a list of absolute path strings
3sys.path.append('/path/to/application/app/folder') # <-- relative path
4
5import your_file
1# test.py
2import sys
3# append current python modules' folder path
4# example: need to import module.py present in '/path/to/python/module/not/in/syspath'
5sys.path.append('/path/to/python/module/not/in/syspath')
6
7import module
1# some_file.py
2import sys
3# insert at 1, 0 is the script path (or '' in REPL)
4sys.path.insert(1, '/path/to/application/app/folder')
5
6import file
1# By default, you can't. When importing a file, Python only
2# searches the current directory, the directory that the
3# entry-point script is running from, and sys.path which includes
4# locations such as the package installation directory
5# (it's actually a little more complex than this, but this covers
6# most cases).
7
8# you can however, add to the path at runtime
9
10import sys
11# insert at position 1 in the path, as 0 is the path of this file.
12sys.path.insert(1, '/path/to/application/app/folder')
13
14import file
15
16file.function()
1#My explanation is a bit too long for a grepper answer, so just paste this into your browser search bar
2#https://hastebin.com/tefosufoji.sql