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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -