I got some help from the cross post on Reddit. If anyone has interest in doing similar, here is the code for config.py to make this work:
is_toggled = True
def move_to_screen(qtile):
global is_toggled
if is_toggled:
qtile.groups[0].cmd_toscreen(0)
qtile.groups[1].cmd_toscreen(1)
qtile.groups[2].cmd_toscreen(2)
is_toggled = False
else:
qtile.groups[3].cmd_toscreen(0)
qtile.groups[4].cmd_toscreen(1)
qtile.groups[5].cmd_toscreen(2)
is_toggled = True
Then here is the key binding:
Key([mod], "w", lazy.function(move_to_screen), desc="test function"),