[Q] ImportError by __import__() on Python >= 3.4
kwa at kuwata-lab.com
Wed Jun 8 05:52:05 EDT 2016
On Tue, Jun 7, 2016 at 7:28 AM, Michael Selik <michael.selik at gmail.com>
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <kwa at kuwata-lab.com> wrote:
>> I have a trouble around __import__().
> The docs for __import__ strongly recommend that you use importlib instead
> The docs for ``importlib.import_module`` suggest that you use
> ``invalidate_caches`` if you are importing dynamically generated files.
> I think you'll find this fixes your bug.
I replaced '__import__()' in my code with 'importlib.invalidate_cache();
and found it worked very well.
Thank you very much.
More information about the Python-list