/* * I can't do this... */ suspend fun doTransaction1(): MyData { newSuspendedTransaction(Dispatchers.IO) { // Some statements... } } suspend fun doTransaction2(): MyDataWithMore { newSuspendedTransaction(Dispatchers.IO) { val result = doTransaction1() // More statements. Error thrown here because doTransaction1() closed the connection } } /* * So I have to do this instead :/ */ suspend fun doTransaction1(): MyData { newSuspendedTransaction(Dispatchers.IO) { doTransaction1Internal() } } suspend fun doTransaction2(): MyDataWithMore { newSuspendedTransaction(Dispatchers.IO) { val result = doTransaction1Internal() // More statements. } } // I feel like I shouldn't have to make this tertiary function suspend fun doTransaction1Internal(): MyData { // Some statements... }