By adding the '% !TeX root = ../../thesis.tex' to the chapter files, TeXstudio (and possibly others) will detects 'thesis.tex' as the root file, so that features like pressing the compile button, label names, ... work correctly.
I've also solved a bug in the run.py script: the variable chaptersdir doesn't exist, so I replaced it by settings.chaptersdir.
By adding the '% !TeX root = ../../thesis.tex' to the chapter files, TeXstudio (and possibly others) will detects 'thesis.tex' as the root file, so that features like pressing the compile button, label names, ... work correctly.
I've also solved a bug in the run.py script: the variable chaptersdir doesn't exist, so I replaced it by settings.chaptersdir.