I have a file called foobar (without .py extension). In the same directory I have another python file that tries to import it:
You can use the
imp.load_source function (from the
imp module), to load a module dynamically from a given file-system path.
foobar = imp.load_source('foobar', '/path/to/foobar')
This SO discussion also shows some interesting options.