I'm making a script in python that writes code to a .py file in the fourm of variables (e.g x = 6). The problem is when I import it to use the variables and then write some code to it I need to use reload() to refresh the import I quess and allow me to use the variable but it wont reload the .py file it will only reload the .pyc file.
Heres some code to help (not so sure it will :/)
I call a function that writes the data to the .py file and then calls a function to reloading the module but it ends up reload the .pyc
make(2, "name", "'Bob'")
def re(module):
reload(module)
print"Reloaded "+ str(module)
def make(0-1-2, var, data):
if 0-1-2 == 1:
TempF.write(var+" = "+data)
TempF.write("\n")
re(Temp)
if 0-1-2 == 2:
PermF.write(var+" = "+data)
PermF.write("\n")
re(Perm)
if 0-1-2 == 0:
MiscF.write(var+" = "+data)
MiscF.write("\n")
re(Misc)
Reloaded <module 'Perm' from 'C:\Users\Admin\PycharmProjects\DeanRobbieRowe\Perm.pyc'>