title: pass a python module to a function
body: <p>Does it ever make sense to pass a module as an argument into a function in python?</p>
  
  <p>My python-sense says this idea is wrong but I'm not sure exactly why.</p>
  
  <p>Here's where I encountered it. I'm using Django's messaging framework, django.contrib.messages . I am also using a parsing module that I wrote for other purposes and importing a class from it into my django application. Then I realized I want to set messages during parsing.</p>
  
  <p>The parsing module does not depend on Django at all, and I'd rather not import django in the parsing module, because that would introduce a dependency.</p>
  
  <p>I imagine the correct answer here is to add a conditional import of django into the parsing module.</p>
  
  <p>But then I thought: why can't I just have the class I'm using in the parsing module accept the messaging module as an optional argument?</p>