Answer the question
In order to leave comments, you need to log in
Python. Import at the right time. Script modification. What should I do?
I have a hosted script, it works around the clock, but often I have to change the input data in it , and therefore I have to stop it, rewrite it and turn it on again, I got the idea to put them in a separate file and import them every time you go into the loop :
while True:
time.sleep(10)
from config import pay,people,dialogs
people = {
'Дима': (200003,'cb85e'),
'Паша': (2003,'cf8c3705'),
'Вест': (20013,'559108f0e06'),
'Вова': (2001,'6664c9'),
'Тома': (201,'a04d7')
}
Answer the question
In order to leave comments, you need to log in
1) you can reload the module: 3.4+ importlib.reload
2) you can run the script through subprocess with packing -> unpacking (for example, through pickle)
3) store it in json/hjson/json5/yaml, etc.
import json
with open('settings.json', encoding='utf-8') as fh:
config = json.load(fh)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question