imp.load_source() throwing "No Module Named" Error Python 2.7
Question: I'm currently using Python 2.7, and I'm trying to load a file like this:

    
    
    myPlt = imp.load_source('SourceFile', 'path/to/SourceFile.py')
    

However, SourceFile.py imports module OtherModule, which is in the same
directory as SourceFile. The package structure looks like this:

    
    
    /path
     .../to
          ...SourceFile.py
          ...OtherModule.py
          ...__init__.py
    

When I run the load_source, I get the error "ImportError: No module named
OtherModule"

Is my load_source call incorrect? Is there an alternate way I should go about
importing SourceFile?


Answer: Try:

imp.load_source("directory", "directory" + "filename.py")

