circular import

I am very new to django I trying to code a flashcard project with mongo db. when I try to add the card app to url patterns and run the server i get this error
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\resolvers.py”, line 520, in check
messages.extend(check_resolver(pattern))
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\botan\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\urls.py”, line 24, in check_resolver
return check_method()

this is my url patterns file
from django.contrib import admin
from django.urls import path, include
import cards.urls

List of URL patterns for the cards app

urlpatterns = [
path(‘cards’,include(‘cards.urls’)),
path(‘admin/’, admin.site.urls),
]

and this is the root config file
INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘cards’,
]

MIDDLEWARE = [
‘django.middleware.security.SecurityMiddleware’,
‘django.contrib.sessions.middleware.SessionMiddleware’,
‘django.middleware.common.CommonMiddleware’,
‘django.middleware.csrf.CsrfViewMiddleware’,
‘django.contrib.auth.middleware.AuthenticationMiddleware’,
‘django.contrib.messages.middleware.MessageMiddleware’,
‘django.middleware.clickjacking.XFrameOptionsMinoddleware’,
]

ROOT_URLCONF = ‘cards.urls’
I have tried to google this error with no success?

Which urls.py file is this?

If this is your cards/urls.py file then the problem is that you’re trying to have this file import itself.

Side note: When posting code or error messages here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted. (Please remember to do this in the future.)

thanks for this advice how do you suggest that I solve this problem, do I use another file or delete the import I am a newbie to django

I have removed import reference ‘’’ import cards ‘’’ but I am still getting the same error?

What are the contents of all urls.py files in your project? What directories are they in?

Thanks so much for your help, you were right the code was importing itself thus the circular error message. I guess being a newbie I still have a lot to learn, I have solved the error.