Refactoring for better separation of concerns

# Original
import ccxt
from loguru import logger
from conversion import to_string
from erlastic import port_connection

logger.add('Logs/waves_exchange.py_error_log_{time}.log',
           format="{time:HH:mm:ss!UTC} {message}",
           rotation="100 MB")


@logger.catch
def connection():
    mailbox, port = port_connection()
    for data in mailbox:

        nested_params = to_string(data)
        key = nested_params[0][0]
        api_key = nested_params[0][1]

        waves_exch = ccxt.wavesexchange({
            'apiKey': api_key,
            'secret': key,
        })
        return (waves_exch, port)


if __name__ == '__connection__':
    connection()
# Version with separation of concerns (SOC)
import ccxt
from loguru import logger
from conversion import to_string
from erlastic import port_connection

logger.add('Logs/waves_exchange.py_error_log_{time}.log',
           format="{time:HH:mm:ss!UTC} {message}",
           rotation="100 MB")

mailbox, open_port = port_connection()


@logger.catch
def port():
# Version with separation of concerns (SOC)
import ccxt
from loguru import logger
from conversion import to_string
from erlastic import port_connection

logger.add('Logs/waves_exchange.py_error_log_{time}.log',
           format="{time:HH:mm:ss!UTC} {message}",
           rotation="100 MB")

mailbox, open_port = port_connection()


@logger.catch
def port():
    logger.info(open_port)
    return open_port


@logger.catch
def config():
    logger.info(mailbox)
    for data in mailbox:

        nested_params = to_string(data)
        key = nested_params[0][0]
        api_key = nested_params[0][1]

        waves_exch = ccxt.wavesexchange({
            'apiKey': api_key,
            'secret': key,
        })
        logger.info(waves_exch)
        return waves_exch
# log report from SOC version
23:17:41 <generator object mailbox_gen at 0x7f215be13350>
23:17:41 Waves.Exchange
23:17:41 <generator object mailbox_gen at 0x7f215be13350>

So the original version operates properly but the SOC version doesn’t. When it’s imported into another module and its config and port methods are called literally nothing happens. What am I missing?

(Btw, here’s the [erlastic](https://github.com/samuel/python-erlastic) library it’s built on, just in case.)