from mcrcon import MCRcon allServerRcon = [] for i in range(len(allServerRcon)): with MCRcon("192.168.1.52", "f{password}", allServerRcon[i]) as mcr: mcr.command("stop")