Okay. So no one wastes time here, the answer is that lb.exec_() returns 0, so the condition in SomeFunction() is never evaluated.

The way to do it is, in the dialog class, to replace QDialog.close() by QDialog.done(int)

Then in SomeFunction, test for:
if lb.exec_() == QDialog.Accepted: