title: How to add two or more sessions in add member telegram
body: <p>Wanted to know how to add two account sessions so they alternately add members of a group but when i use: client2(InviteToChannelRequest(target_group_entity,[user_to_add])) error occurs from different channels. I'm trying to add my group members to another channel.
  This code has already started the two sessions, the first one is more configured and I wanted to know what to do for the second session to work</p>
  <pre><code>#First Session
  api_id = xxxx    #Your Api ID
  api_hash = 'xxxx'    #Your Api Hash
  phone = 'xxxx'      # Your Phone Number With Country Code.
  client = TelegramClient(phone, api_id, api_hash)
  client.connect()
  print(client.get_me().username, '- Sucessfully Connected! ')
  
  if not client.is_user_authorized():
      client.send_code_request(phone)
      client.sign_in(phone)
      try:
          client.sign_in(code=input('Enter code: '))
      except SessionPasswordNeededError:
          client.sign_in(password=getpass.getpass())
  time.sleep(5)
  
  #Second Session
  api_id2 = xxxx    #Your Api ID
  api_hash2 = 'xxxx'    #Your Api Hash
  phone2 = '+xxxxx'      # Your Phone Number With Country Code.
  client2 = TelegramClient(phone2, api_id2, api_hash2)
  client2.connect()
  print(client2.get_me().username, '- Sucessfully Connected! ')
  
  if not client2.is_user_authorized():
      client2.send_code_request(phone2)
      client2.sign_in(phone2)
      try:
          client2.sign_in(code=input('Enter code: '))
      except SessionPasswordNeededError:
          client2.sign_in(password=getpass.getpass())
  time.sleep(5)
  
  def add_users_to_group():
      users = []
      with open(r&quot;scrapped&quot;, encoding='UTF-8') as f:
          rows = csv.reader(f,delimiter=&quot;,&quot;,lineterminator=&quot;\n&quot;)
          next(rows, None)
          for row in rows:
              user = {}
              user['username'] = row[0]
              try:
                  user['id'] = int(row[1])
                  user['access_hash'] = int(row[2])
              except IndexError:
                  print ('users without id or access_hash')
              users.append(user)
  
  random.shuffle(users)
  chats = []
  last_date = None
  chunk_size = 10
  groups=[]
  
  result = client(GetDialogsRequest(
              offset_date=last_date,
              offset_id=0,
              offset_peer=InputPeerEmpty(),
              limit=chunk_size,
              hash = 0
          ))
  chats.extend(result.chats)
  
  for chat in chats:
      try:
          if chat.megagroup== True: #Condition To Only List Megagroups
              groups.append(chat)
      except:
          continue
  
  #print('Choose a group to add members:')
  i=0
  print(&quot;\n|-|-|-|-| GRUPOS |-|-|-|-|&quot;)
  for group in groups:
      print(str(i) + '- ' + group.title)
      firstname = groups[i].title
      if firstname.split()[0] == &quot;Grupo&quot;:
          g_index = i;
      i = i + 1
  print(&quot;\n&quot;)
  target_group=groups[int(g_index)]
  
  target_group_entity = InputPeerChannel(target_group.id,target_group.access_hash)
  
  #mode = int(input(&quot;Enter 1 to add by username or 2 to add by ID: &quot;))
  
  error_count = 0
  
  try:
      if user['username'] == &quot;&quot;:
          print (&quot;Adicionando {}&quot;.format(user['id']))
      else:
          print (&quot;Adicionando {}&quot;.format(user['username']))
      user_to_add = InputPeerUser(user['id'], user['access_hash'])
      client(InviteToChannelRequest(target_group_entity,[user_to_add]))
      print(&quot;Espere 60 Segundos...&quot;)
      time.sleep(60)
  except PeerFloodError:
      print(&quot;Obtendo o erro de flood do telegrama. Você deve interromper o script agora. Tente novamente depois de algum tempo.&quot;)
  except UserPrivacyRestrictedError:
      print(&quot;As configurações de privacidade do usuário não permitem que você faça isso. Pulando.&quot;)
  except:
      traceback.print_exc()
      print(&quot;Erro inesperado&quot;)
      error_count += 1
      if error_count &gt; 10:
          sys.exit('Muitos erros!')
  
  def list_users_in_group():
      chats = []
      last_date = None
      chunk_size = 200
      groups=[]
  
  result = client(GetDialogsRequest(
              offset_date=last_date,
              offset_id=0,
              offset_peer=InputPeerEmpty(),
              limit=chunk_size,
              hash = 0
          ))
  chats.extend(result.chats)
  
  for chat in chats:
      try:
          print(chat)
          groups.append(chat)
          # if chat.megagroup== True:
      except:
          continue
  
  
  mode = 2
  add_users_to_group()
  </code></pre>