python – Python3 – reload() can not be called on __import__ object?

python – Python3 – reload() can not be called on __import__ object?

The reload built-in function has been moved to importlib module in Python 3.4:

In [18]: from importlib import reload

In [19]: reload?
Reload the module and return it.

The module must have been successfully imported before.

As pointed out by @JPaget in comments reload() function has been moved from imp to importlib module in Python 3.4+. From whats new in Python 3.4:

The reload() function has been moved from imp to importlib as part of
the imp module deprecation

python – Python3 – reload() can not be called on __import__ object?

Leave a Reply

Your email address will not be published.