I cloned a sample app for django and run code inspection and found that admin.autodiscover is called before importing the views file, that's used for the patterns later:
from django.contrib import admin
from django.urls import path
admin.autodiscover()
import hello.views
urlpatterns = [
path("", hello.views.index, name="index"),
...
]
This triggers a PEP8 code style warning as the imports are not all on the top of the file. I'm afraid that moving it may have unintended side effects. Is that the case?