from otree.api import * class C(BaseConstants): import os import random path=["D:\Otree\picture"] files=os.listdir(path) d=random.choice(files) os.startfile(d) import glob, random file_path_type = ["D:/Otree/picture"] images = glob.glob(random.choice(file_path_type)) random_image = random.choice(images)