PsychoPy Experiment stuck on initializing - Pavlovia Pilot

I suspect that you have unbalanced brackets in codeDiamonds (trial). If import random is the only reason that code component is set to “Both” you could move that line to a dedicated Both/Python code component.