Say there is a folder, \'/home/user/temp/a40bd22344\'. The name is completely random and changes in every iteration. I need to be able to import this folder in Python using
Here's one way to do it, without touching sys.path, using the imp
module in Python:
import imp
f, filename, desc = imp.find_module('a40bd22344', ['/home/user/temp/'])
project = imp.load_module('a40bd22344', f, filename, desc)
project.some_func()
Here is a link to some good documentation on the imp
module: