title: How to instantiate a class just after starting Django server and access its members later in views.py
body: <p>I want to define a class <code>PacketCount</code> in Django.</p>
  <pre><code>class PacketCount:
      def __init__():
          self.count_pkts = 0
      def count_pkts():
          #logic to count the number of packets
  </code></pre>
  <p>I want to instantiate the object of <code>PacketClass</code> and continuously run the function <code>count_pkts()</code> just after starting starting the Django server using the command <code>python manage.py runserver</code>.</p>
  <p>views.py contains the following function:</p>
  <pre><code>def index(request):
      # access PacketCountObj.count_pkts
      # return HttpResponse to display the value of PacketCountObj.count_pkts
  </code></pre>
  <p>urls.py contains the following:</p>
  <pre><code>urlpatterns = [
      path('', views.index, name='index'),
  ]
  </code></pre>
  <p>I am unable to figure out a way to automatically instantiate PacketCount class, call <code>PacketCountObj.count_pkts()</code> (possibly using a thread) on starting the Django server and then access <code>PacketCountObj.count_pkts</code> inside the views.py.<br />
  I do not want to use databases, django sessions etc.</p>