I have a function $f$ that is continuous over the set of variables, $f: \ K \times M \to \mathbb{R}$, where $K$ is a compact domain of a metric space and $M$ is a metric space. And I want to prove that the function $g(y)=\sup_{x\in K} f(x,y)$ is continuous.
As $K$ is a compact, $f$ is uniformly continuous with respect to its first argument. Also, for the same reason, $g(y)=\sup_{x\in K} f(x,y)=\max_{x\in K} f(x,y)$.
For now, I know that for the case of $f$ is continuous with respect of each variable separately, this doesn't work (see an example here Is supremum over a compact domain of separately continuous function continuous?) and there is a proof for the case when $M$ is also a compact, or $f$ is just uniformly continuous on $M$, too (How prove this $g(x)=\sup{\{f(x,y)|0\le y\le 1\}}$ is continuous on $[0,1]$), which I personally doubt as there is no guatantee that y-s will be close there (in my notations they are x-s).
All my tries fail when I come to the point where I need to say something about argmaxes of even close y-s. For example:
I consider a sequence $y_n \to y_0$ with $n\to\infty$. For each $y_n$ there exists $x_n$ such that $g(y_n)=\max_{x\in K} f(x,y_n)=f(x_n,y_n).$ Then, I try to estimate the difference $$|g(y_{n+k})-g(y_n)|=|f(x_{n+k},y_{n+k})-f(x_n,y_n)|=|f(x_{n+k},y_{n+k})-f(x_{n+k},y_{n})+f(x_{n+k},y_{n})-f(x_n,y_n)|\le|f(x_{n+k},y_{n+k})-f(x_{n+k},y_{n})|+|f(x_{n+k},y_{n})-f(x_n,y_n)|.$$ One can easily see that the first component tends to zero with $k\to\infty$, but I have no idea what to do with the second one...
Any help would be very appreciated!