Python reload file -


i have script computes stuff. uses inputs separate file 'inputs.py'.

in 'inputs.py' few variables:

a = 2.3 b = 4.5 c = 3.0 

in main file import them with

from inputs import * 

if change in 'inputs.py' , execute script again still uses old values instead of new ones. how can reload file?

reload(inputs) 

does not work.

many in advance!

if using python 3.x , reload names have been imported using from module import name , need -

import importlib import inputs #import module here, can reloaded. importlib.reload(inputs) inputs import # or whatever name want. 

for python 2.x , can -

import inputs   #import module here, can reloaded. reload(inputs) inputs import # or whatever name want. 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -