I am trying to refresh perhaps reload the whole file I imported on a script in which I used to changed some things within that file, and using that script to reload the file I imported within itself.
How do I refresh a file which is a script that has been imported as a module after making changes on it using the script which contains that imported file.
This is what I am trying to achieve
#lists_values.py
Christine = [0,0,0]
George = [900,123,1]
#suppose Ralf = [ 0, 0, 0 ] is going at this position soon.
#main.py
from lists_values import *
import lists_values
def insertRalf():
with open("lists_values.py", "a") as myfile:
myfile.write("Ralf = [0, 0, 0]\n")
insertRalf()
def resultView():
#Maybe some code to refresh the file I imported? Which is the lists_value since I added another list I want to print it.
#Print the NEW values of lists_values
fd = open("lists_values.py", "r")
print(fd.read())
fd.close()
#My goal is to see the new value 'Ralf', but since I imported the file when it was still unchanged, I wont see any Ralf if I print it now.
resultView()