Answer the question
In order to leave comments, you need to log in
How to write a variable from a function from one file to another?
In file1.py After the user answers the bot's questions, they are written to answer1 and answer2, how do I make sure that these answer1 and answer2 variables are written \ saved in otvet1 and otvet2 in another config.py file?
Here is a piece of file1.py code:
@dp.message_handler(state=Test.Q2)
async def answer_q2(message: types.Message, state: FSMContext):
# Достаем переменные
data = await state.get_data()
answer1 = data.get("answer1")
answer2 = message.text
await message.answer("Спасибо за ваши ответы!")
config.otvet1 = answer1 #это не работает =(
config.otvet2 = answer2 #это не работает =(
await message.answer(f'Вы сохранили: +config.otvet1+config.otvet2)
await state.finish()
otvet1 = ' '
otvet2 = ' '
Answer the question
In order to leave comments, you need to log in
.cards__list-wrapper {
margin: 0;
}
.cards__item:first-child, .cards__item:nth-child(5n) {
padding: 0 15px 0 0;
}
.cards__item:nth-child(4n) {
padding: 0 0 0 15px;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question