Hello,
Instead of having the code in a block in the same place, the use of microservices is heavily recommended.
So for example instead of having the same request and response by different functions, you could try to diversify the files used for example in spring boot or Java javascript, or Go having responses from the server but not at the same time and interacting with each other.
Microlints is an outdated programming method where the code is in the same place.
There are two methods then you could use for example active connection like TCP on SOAP or UDP where you send a request and await a response from the server after that.