W
W
Wynell_ru2020-05-12 12:00:36
Python
Wynell_ru, 2020-05-12 12:00:36

How to re-import a variable from a Python file?

Good afternoon!
I have a config.py file with some variables
AND in the main.py file the situation is like this:

from config import templates, admins

# ...

def reload():
    # ... здесь templates и admins должны заново импортироваться из config-а,
    # так как эту функцию я планирую вызывать только в случае обновления этого самого config-a
    pass

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2020-05-12
@Wynell_ru

why do you need to reimport?
just reassign and that's it.
and the config must be stored in the * .ini file
or configparser works fine with them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question