Load module with variable path in python 2.6?
<p>My dev environment is python 2.6, so the importlib.import_module() syntax is not available to me. I'm trying to load a module with a path that is set by a variable; is this even possible in 2.6?</p>

<p>The background is that I'm polling a number of devices from different vendors, so in various directories I have wrapper classes, all with identical methods and return types, which handle the vendor-specific methods for grabbing the data I need. So based on the vendor, I might need to load "platform_foo.stats" or "platform_bar.stats", then call the same methods on the resulting module.</p>

<p>So, something like this, except this is obviously non-working code:</p>

<pre><code>vendor = get_vendor(hostname)
vendor_path = 'platform_%s.stats' % vendor
import vendor_path
stats = vendor_path.stats(constructor_args)
</code></pre>

<p>Any ideas?</p>
