python: function that will call itself
<p>i was wondering if i can get your help with the stucture.logic of a function that will need to call itself</p>

<pre><code>def populate_frequency5(d,data,total_compare):
  freq=[]
  prev = None
  for row in d:
    if prev is None or prev==row[11]:
      freq.append(row[16])
      doctor=row[10]
      drug=row[11][:row[11].find(' ')].capitalize()
    else:
      make_image_url_doctor(freq,doctor,drug,data)
      total_compare=True
      del freq[:]
    prev=row[11]  
  if total_compare:
    (b1,bla,bla1)=medications_subset2(data,[drug.upper()])
    data1=calculate_creat_conc4(b1)
    populate_frequency5(data1,['a'],total_compare=True)
    total_compare=False
</code></pre>

<ol>
<li><p>the first time the function is called i need it to run this:</p>

<pre><code>def populate_frequency5(d,data,total_compare):
  freq=[]
  prev = None
  for row in d:
    if prev is None or prev==row[11]:
      freq.append(row[16])
      doctor=row[10]
      drug=row[11][:row[11].find(' ')].capitalize()
    else:
      make_image_url_doctor(freq,doctor,drug,data)
      (b1,bla,bla1)=medications_subset2(data,[drug.upper()])
      data1=calculate_creat_conc4(b1)
      del freq[:]
    prev=row[11]
</code></pre></li>
<li><p>then somehow the second time when i call it, i need it to run this way:</p>

<pre><code>def populate_frequency5(d,data,total_compare):
 freq=[]
 prev = None
 for row in d:
   if prev is None or prev==row[11]:
     freq.append(row[16])
     doctor=row[10]
     drug=row[11][:row[11].find(' ')].capitalize()
 run_another_function()
</code></pre></li>
</ol>
