0 votes
1 view
in Python by (47.8k points)

I know it can be done, but I never remember how.

How can you re import a module in python? The scenario is as follows: I import a module interactively and tinker with it, but then I face an error. I fix the error in the .py file and then I want to re-import the fixed module without quitting python. 

How can I do it?

1 Answer

0 votes
by (107k points)

You can re-import a module in python, by using the importlib and its function reload. 

import importlib


If you are using python 3.2 or 3.3 you can use the following code:-

import imp


Welcome to Intellipaat Community. Get your technical queries answered by top developers !