You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checking if a module can be imported
If you need to find out if a module can be imported without actually doing the import, then you should use importlib.util.find_spec().
The example at https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported is misleading:
But
importlib.util.find_spec
will import parent modules if a submodule is provided https://docs.python.org/3/library/importlib.html#importlib.util.find_specUsers reading this example probably do not expect anything to get imported at all
The text was updated successfully, but these errors were encountered: