title: Python grpc: AttributeError 'NoneType' object has no attribute 'unary_unary'
body: <p>My first time playing around with Python and grpc. I have been troubleshooting for a while now and cant seem to get past the below issue.</p>
  <p>I am getting the following error by running: <strong>venv/bin/python placeholder.py</strong> (excuse the file name Im still sandboxing).</p>
  <p><strong>Error:</strong></p>
  <pre><code>Traceback (most recent call last):
    File &quot;placeholder.py&quot;, line 50, in &lt;module&gt;
      client = BitcClient()
    File &quot;placeholder.py&quot;, line 20, in __init__
      self.stub = pb2_grpc.BranchesStub(self.channel)
    File &quot;/Users/me/PycharmProjects/app/infrastructure/v3/branches_pb2_grpc.py&quot;, line 18, in __init__
      self.ListBranches = channel.unary_unary(
  AttributeError: 'NoneType' object has no attribute 'unary_unary'
  </code></pre>
  <p>Here are the specs of my setup:</p>
  <p><strong>Specs:</strong></p>
  <pre><code>certifi==2022.6.15
  charset-normalizer==2.1.1
  grpcio==1.39.0
  grpcio-tools==1.39.0
  idna==3.3
  protobuf==3.20.1
  requests==2.28.1
  six==1.16.0
  urllib3==1.26.12
  
  (venv) % venv/bin/python --version
  Python 3.8.9
  </code></pre>
  <p>Here is my client code. The server code I do not have access to as it is built by another team.</p>
  <p><strong>Client code:</strong></p>
  <pre><code>import grpc
  import app.infrastructure.v3.branches_pb2 as pb2
  import app.infrastructure.v3.branches_pb2_grpc as pb2_grpc
  
  class Client(object):
      
      def __init__(self):
          self.server = 'api.domain.com:443'
      
          # instantiate a channel
          self.channel = grpc.insecure_channel('{}'.format(self.server))
          self.channel = grpc.channel_ready_future(self.channel).result(timeout=3)
      
          # bind the client and the server
          self.stub = pb2_grpc.BranchesStub(self.channel)
      
      def get_branches(self, message):
          message = pb2.ListBranchesResponse(message=message)
          print(f'{message}')
          return self.stub.ListBranches(message)
  
  if __name__ == '__main__':
  
      api_client = Client()
      result = api_client()
  </code></pre>
  <p>Below is relevant code that was generated from .proto files:</p>
  <p><strong>Proto generated code:</strong></p>
  <pre><code>class BranchesStub(object):
      &quot;&quot;&quot;Operations to manage branches and their releation to projects.
      &quot;&quot;&quot;
  
      def __init__(self, channel):
          &quot;&quot;&quot;Constructor.
  
          Args:
              channel: A grpc.Channel.
          &quot;&quot;&quot;
          self.ListBranches = channel.unary_unary(
                  '/app.infrastructure.v3.Branches/ListBranches',
              
  
      request_serializer=dot_app_dot_infrastructure_dot_v3_dot_branches__pb2.ListBranchesRequest.SerializeToString,
                      response_deserializer=dot_app_dot_infrastructure_dot_v3_dot_branches__pb2.ListBranchesResponse.FromString,
                      )
      ...
  
  class BranchesServicer(object):
      &quot;&quot;&quot;Operations to manage branches and their releation to Console projects.
      &quot;&quot;&quot;
  
      def ListBranches(self, request, context):
          &quot;&quot;&quot;List all created branches (and their status) for the specified project
          &quot;&quot;&quot;
          context.set_code(grpc.StatusCode.UNIMPLEMENTED)
          context.set_details('Method not implemented!')
          raise NotImplementedError('Method not implemented!')
  </code></pre>
  <p>Help would be greatly appreciated!</p>