Any way to organize script in coder view or divide it into sections?

I just created my first script in PsychoPy and it is really messy, especially with all the comments. Just wondering, is there any way to organize it or to divide it into sections, just like Matlab (by using %%)? Thanks!

You don’t have to use the rather simple PsychoPy code editor. Alternative text editors or Python IDEs might provide a “code folding” option, for example where you click on a disclosure triangle to see the code under a function definition.

And never think of comments as messy. They’re the most beautiful decoration your code can have :wink:

I agree with you that comments are beautiful! And I love them so much. But it is just that the editor in Psychopy looks very dull and unorganized, with no options for headers, unlike matlab.
I will take your advice and look for some text editors or IDEs? Any recommendations? I found notepad++ and Pydev.

Anyway, how do you run the script on other editors? In Psychopy, its just ctrl + r. Thanks!