I have 2 Python files,
one is main.py (main code) and other is source.py (functions).
I import source.py into the main.py and call all the functions defined in source.py.
But when I write a new function at the run time, it will be shown in by the source.py's object but when called it shows an error.
# source.py
def fun1():
print('India is the best !!!!!!!!!')
def fun2():
print('Delhi is capital of India !!!!!!!!!')
# main.py
import source
source.fun1()
source.fun2()
This code runs properly.
When I add a new function to the source.py
def fun3():
print('Modi is India's Prime minister!!!!!!!')
If I import source.py again and call fun3() from main.py, It show the following error :
Traceback (most recent call last): File "", line 1, in AttributeError: module 'source' has no attribute 'fun3'
I want to know how to re-import the source.py so that it uses newly coded function without restarting the IDE I am using.
I am using Visual Studio 2017 for development in python
TIA