title: Splitting a Python class among multiple modules using packages
body: <p>I wrote some code in python as a class, but now I'm trying to prepare it for distribution as a package and I was having some trouble with figuring out how the different pieces should fit together.</p>
  
  <p>So, as I originally wrote the code I had a class with a few functions in it, including an <code>__init__</code> function. I've now split each of these functions into its own file named with the function name, but I'm unsure where to put the <strong>init</strong> function, since it takes arguments. An example is below.</p>
  
  <p>Original format:</p>
  
  <pre><code>class className(object):
  
      def __init__(self, arg1, arg2):
           self.arg1 = arg1
           self.arg2 = arg2
  
      def func1(self):
  
      def func2(self, arg3):
  </code></pre>
  
  <p>With a usage of:</p>
  
  <pre><code>import name
  
  a = name.className(arg1, arg2)
  a.func1()
  a.func2(arg3)
  </code></pre>
  
  <p>Now the file tree is:</p>
  
  <pre><code>Name/
      /className
          __init__.py
          func1.py
          func2.py
  </code></pre>
  
  <p>And on to include the other functions. I would like to keep the same basic usage pattern as the original.</p>
  
  <p>Now, the question I have is where that <code>__init__</code> function should go? Inside the <code>__init__.py</code> file? Somewhere else? The other issue is I wanted to put some imports in the <code>__init__.py</code> file; I know they should go in the <code>__init__.py</code> file, but I don't know how they relate to the <code>__init__</code> function. Any help is appreciated. </p>