eval to import a module
Use exec
:
exec 'import vfs_tests as v'
eval
works only on expressions, import
is a statement.
exec
is a function in Python 3 : exec('import vfs_tests as v')
To import a module using a string you should use importlib
module:
import importlibmod = importlib.import_module('vfs_tests')
In Python 2.6 and earlier use __import__
.