Importing a module dynamically using imp Importing a module dynamically using imp python python

Importing a module dynamically using imp


imp.load_source requires the pathname + file name of the module to import, you should change your source for the one below:

mod = imp.load_source("bar","./foo/bar.py")


Appears to be a simple pathing problem - check __file__ or cwd... Maybe try an absolute file path first? - This imp example may help.