Is there any way to check if an import will succeed but still keep the import mostly lazy?
What I want is something like:
try:
lazy import numpy
using_numpy = True
except ImportError:
using_numpy = False
# Here numpy is still only lazily imported
Obviously this requires some part of the import machinery to at least access the filesystem so it could not be a completely lazy import.