Use ScheduleExit() on not running loop Error

I use a button to return last Interface,so, current interface must be closed, in last interface ,I first click the interface,appear error above:
wx._core.wxAssertionError: C++ assertion ““IsRunning()”” failed at …\src\common\evtloopcmn.cpp(92) in wxEventLoopBase::Exit(): Use ScheduleExit() on not running loop

The above exception was the direct cause of the following exception:

SystemError: <class ‘wx._grid.GridEvent’> returned a result with an error set

his question has puzzled me for a long time. In China, there are few relevant materials. I hope to be answered,thanks