def _runServices(targetHost, timeout): global remote global restService logger.debug("Create remote connection") remote = RemoteConnection(host=targetHost) if timeout: remote.inactivityTimeoutSec = timeout logger.debug("Create REST service") restService = RestService() RestService.remoteConnection = remote restService.start() while True: time.sleep(10)