title: Calling a model's method from outside Django
body: <p>I have a Django model with some static methods. I'd like to call the methods from outside the application (cronjob).</p>
  
  <p>The model I have:</p>
  
  <pre><code>class Job(models.Job):
      #Irrelevant information
  
      @staticmethod
      def methodIwantToCall():
          #statements
  </code></pre>
  
  <p>I have the following python file that I'm using for the cron job:</p>
  
  <pre><code>#!/usr/bin/python
  # -*- coding: UTF-8 -*-
  
  import os
  os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
  
  from myapp.models import Job
  
  Job.methodIwantToCall()
  </code></pre>
  
  <p>At first, I was having an error about <code>DJANGO_SETTINGS_MODULE not being set</code> and I fixed that, however, now I have the following error: <code>No module named myapp.utils</code></p>
  
  <p>I feel like I'm doing something that I'm not supposed to do. So how do I call that static method the way I want it to be called?</p>
  
  <p>EDIT: It looks like the paths are getting messed up when I'm importing from outside Django. For example, I have an import in my models file, when I call the cron file it fails importing with the message <code>ImportError: No module named myapp.utils</code> even though it's working.</p>