title: How to pass parameters into __init__ function
body: <p>I am starting my journey in python. I want to create a program that will convert my xlsx file into an sql file and then load data into a data base.</p>
  
  <p>I want to create class that will have two parameters:</p>
  
  <ul>
  <li>ex - will open xlsx workbook</li>
  <li>sh - will open sheet from ex with correct index</li>
  </ul>
  
  <p>This is initial version (for now I am just printing rows):</p>
  
  <pre><code>class XToSql():
      def __init__(self, ex = xlrd.open_workbook('ex1.xlsx'), sh = ex.sheet_by_index(0)):
          self.ex = ex
          self.sh = sh
  
      def modify(self):
          for i in str((self.sh.nrows-1)):
              a = 1
              print(self.sh.row_values(a))
              a += 1
  
  a1 = XToSql()
  a1.modify()
  </code></pre>
  
  <p>In the <code>__init__</code> function, this line is marked with red color: <code>sh = ex.sheet_by_index(0) -&gt;</code> and this error appears after Run: 
  <code>def __init__(self, ex = xlrd.open_workbook('ex1.xlsx'), sh = ex.sheet_by_index(0)):</code></p>
  
  <pre><code>NameError: name 'ex' is not defined
  </code></pre>
  
  <p>Any ideas what I am doing wrong?</p>