title: Why is a Python class initialized variable not available to a class instance object from a package import but is otherwise?
body: <p>heyo... i'm learning decorators. interesting stuff. i think i'm missing something though, or maybe it's not the decorators but how i'm working with classes? when I do this in terminal it works: </p>
  
  <pre><code>class Client:
      """The main client."""
  
      def __init__(self, config, creds):
          """Initialize."""
          self.config = config
          self.creds = creds
  
      def context(func, *args, **kwargs):
          @wraps(func)
          def func_with_context(*args, **kwargs):
              print(f'contextualizing {func.__name__}')
              print(creds.user_name)
              return (args, kwargs)
          return func_with_context
  
      @context
      def test(self, creds):
          pass 
  </code></pre>
  
  <p>i have two package objects i can instantiate and pass in: </p>
  
  <pre><code>creds = mypackage.credentials.auto()
  config = mypackage.Configuration()
  </code></pre>
  
  <p>and then when i do: </p>
  
  <pre><code>client = Client(config, creds)
  client.test('yo')
  &gt;&gt;&gt;contextualizing test
  username@org
  ((&lt;__main__.Client object at 0x101b66208&gt;, 'yo'), {})
  </code></pre>
  
  <p>but when i do this from the package itself i get </p>
  
  <pre><code>import mypackage as mypackage
  client = mypackage.Client(config, creds)
  client.test('yo')
  contextualizing test
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/Users/dblack/Code/mypackage/mypackage/client.py", line 51, in func_with_context
      creds.user_name,
  NameError: name 'creds' is not defined
  </code></pre>
  
  <p>why would this work when i just declare a class but not when it's in the package namespace?</p>