S
S
SPeeDow2021-12-27 15:29:13
Python
SPeeDow, 2021-12-27 15:29:13

How to fix a bug in Python?

I am writing a menu for a project:

import fun
from general import Users_list
from config import gs
def nm():
    #Todo: создаём тело первого меню
    print(f'Привет, это начальное меню!\n'
          f'Вот клавиши: \n'
          f'1 - войти\n'
          f'2 - посмотреть информацию\n'
          f'3 - посмотреть список аккаунтов')
    #Todo: прописываем логику меню (ГК)
    n = input('-> ')  # Разрешаем вводить символы и записываем их в переменную N
    if n == 1:
        pass
    elif n == 2:
        print(f'Создатель базы данных: {gs["Creator"]}\n'
              f'Дата создания базы: {gs["Data_1"]}')
    elif n == 3:
        print(*Users_list)


Gives an error after launch
ImportError: cannot import name 'nm' from partially initialized module 'menu' (most likely due to a circular import)

What to do, how to decide?

I don't see a cyclic import

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SPeeDow, 2021-12-27
@SPeeDow

I myself found a solution, although I did not understand what the problem was ... I
deleted a piece and it all worked ... from general import Users_list

S
Sergey Gornostaev, 2021-12-27
@sergey-gornostaev

Get rid of cyclic imports, obviously.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question