Using Python , How to add user to existing groups?

Hello Community,

Refering to [1.0.0 / User Management & Permissions] on

I have " 5 new users" (created via python) , now i want to add it to existing group using python.

user = User.create_new(“Dummy1”, “fname”, “lname”, “”, “password123”)
user = User.create_new(“Dummy2”, “fname”, “lname”, “”, “password123”)
user = User.create_new(“Dummy3”, “fname”, “lname”, “”, “password123”)
user = User.create_new(“Dummy4”, “fname”, “lname”, “”, “password123”)
user = User.create_new(“Dummy4”, “fname”, “lname”, “”, “password123”)

I already have existing 2 user groups , i.e Viewers , Analysts

Now I want to Assign user Dummy 1 and Dummy 2 to Group “Analysts” and I want to Assign user Dummy 3, Dummy 4 and Dummy 5 to Group “Viewers” :- like below

Groups User
Analyst Dummy 1
Analyst Dummy 2
Viewers Dummy 3
Viewers Dummy 4
Viewers Dummy 5

Now If I try to assign the user to the Group using “group.add_user(user)”

However , how to I assign my existing Group Name to the group variable ?

Hi Community,

Issue is resolved now using python Method is given below

user1 = User.create_new(“Dummy1VivekOza”, “Vivek”, “Oza”, “”, “Celonis@123”)
user2 = User.create_new(“Dummy2VivekOza”, “Vivek”, “Oza”, “”, “Celonis@123”)
user3 = User.create_new(“Dummy3VivekOza”, “Vivek”, “Oza”, “”, “Celonis@123”)
user4 = User.create_new(“Dummy4VivekOza”, “Vivek”, “Oza”, “”, “Celonis@123”)
user5 = User.create_new(“Dummy5VivekOza”, “Vivek”, “Oza”, “”, “Celonis@123”)

my_list_analysts_groupname = [“Analysts”]
my_list_viewers_groupname = [“Viewer”]

group = Group.load_all()
user = User.load_all()

for ga1 in group:
for ga in my_list_analysts_groupname:
if == ga:

group = Group.load_all()
user = User.load_all()

for gv1 in group:
for gv in my_list_viewers_groupname:
if == gv:

Similarly , can also delete users

my_list_del_username = [“Dummy3VivekOza”,“Dummy4VivekOza”,“Dummy5VivekOza”]
users = User.load_all()
for u in users:
for d in my_list_del_username:
if u.username == d:

Thanks and Regards
Vivek Oza