Suppose the topological space $X$ is the union of two open pathwise connected subspaces $U_1$ and $U_2$ whose intersection is also pathwise connected. Let $x\in U_1\cap U_2$ and let $f_k:\pi_1(U_k,x)\to G$ ($k=1,2$) be a homomorphism, where $G$ is a group. Assume $f_{U_1}\circ (i_{U_1})_\ast=f_{U_2}\circ (i_{U_2})_\ast$, where the $i_{U_k}$ are the inclusions. Consider a loop $\gamma:I\to X$ based at $x$; assume $I$ is divided into subintervals $I_j=[x_j,x_{j+1}]$ ($j\in \Lambda$) so that the image of $\gamma\restriction_{I_j}$ lies entirely within $U_1$ or $U_2$. Let $\beta_i: I\to U_1\cap U_2$ be a path with $\beta_i(0)=x,\beta_i(1)=\gamma(x_i)$. Then the concatenation $\Gamma_i=\beta_{i-1} \cdot \gamma\restriction_{I_{i+1}}\cdot \beta_i^{-1}$ is a path in $U_k$ for some $k\in\{1,2\}$. And we can consider the product of $f_{U_i}([\Gamma_i])$ over all $i\in \Lambda$. (If $\Gamma_i$ lies in $U_i$, then the image under $f_{U_i}$ (of $[\Gamma_i]$) is taken.)
I'm trying to understand why the value of the product is independent of the choice of the partition of $I$ into the $I_j$ as well as of the choice of $\beta_i$. I have no idea about the former, and the latter doesn't even look plausible for me. If $\delta_i$ is a path which enjoys the properties of $\beta_i$, then I guess I have to show that $\delta_i$ is fixed-end-point homotopic to $\beta_i$ (or what else can I show?), but the intersection needn't be simply connected.. So the independence of both choices looks quite mysterious for me.
We need some more precision.
1) Let $I$ be divided into $n$ subintervals $I_j = [x_{j-1},x_j]$, $j = 1,\dots,n$, such that $\gamma(I_j)$ is contained in $U_1$ or $U_2$.
2) For $j = 1,\dots,n-1$ let $\beta_j : I \to U_1 \cap U_2$ be a path such that $\beta_j(0) = x, \beta_j(1) = \gamma(x_j)$. For $j = 0, n$ let $\beta_j$ be the constant path $\beta_j(t) \equiv x$.
3) For each $j = 1\dots,n$ choose $k(j) \in \{ 1,2 \}$ such that $\gamma(I_j) \subset U_{k(j)}$. Note that $\gamma(I_j) \subset U_1 \cap U_2$ is possible. For $j = 1,\dots,n$ define a closed path in $U_{k(j)}$ by $$\Gamma_j = \Gamma_j(\beta_{j-1},\beta_j) = \beta_{j-1} \cdot \gamma \mid_{I_j} \cdot \beta^{-1}_j .$$ Then define $$f(\gamma) = f_{k(1)}([\Gamma_1]) \dots f_{k(n)}([\Gamma_n]) \in G.$$
The claim is that $f(\gamma)$ does not depend on the above choices.
a) Independence of the choice of $\beta_j$.
Recall that a choice was made only for $j = 1,\dots,n-1$. Thus it suffices to show that for $j = 1,\dots,n-1$ $$f_{k(j)}([\Gamma_j(\beta_{j-1},\beta_j)]) f_{k(j+1)}([\Gamma_{j+1}(\beta_j,\beta_{j+1})]) = f_{k(j)}([\Gamma_j(\beta_{j-1},\beta'_j)]) f_{k(j+1)}([\Gamma_{j+1}(\beta'_j,\beta_{j+1})]).$$ The path $\delta_j = \beta'_j \cdot \beta^{-1}_j$ is a closed path in $U_1 \cap U_2$ which begins and ends at $x$. Let $i_k : U_1 \cap U_2 \to U_k$ denote inclusion. We write $$\phi = f_1 \circ (i_1)_* = f_2 \circ (i_2)_* .$$ We have $$[\Gamma_j(\beta_{j-1},\beta'_j)] \cdot [i_{k(j)}\delta_j] = [\Gamma_j(\beta_{j-1},\beta_j)]$$ and therefore $$f_{k(j)}([\Gamma_j(\beta_{j-1},\beta_j)]) = f_{k(j)}([\Gamma_j(\beta_{j-1},\beta'_j)]) f_{k(j)}([i_{k(j)}\delta_j]) = f_{k(j)}([\Gamma_j(\beta_{j-1},\beta'_j)]) f_{k(j)}(i_{k(j)})_*([\delta_j])$$ $$= f_{k(j)}([\Gamma_j(\beta_{j-1},\beta'_j)]) \phi([\delta_j]) .$$ Similarly we see that $$ f_{k(j+1)}([\Gamma_{j+1}(\beta_j,\beta_{j+1})]) = \phi([\delta_j])^{-1} f_{k(j+1)}([\Gamma_{j+1}(\beta'_j,\beta_{j+1})])$$ which completes the proof of a).
b) Independence of the choice of $k(j)$.
A choice is only possible when $\gamma(I_j) \subset U_1 \cap U_2$. In that case we use $f_1 \circ (i_1)_* = f_2 \circ (i_2)_*$.
c) Independence of the choice of the partition of $I$.
Let us first consider a refinement of $\{ I_j \}$ by inserting one additional partition point between $x_j$ and $x_{j+1}$ for some $j$. By considerations similar as in a) we see that this does not change $f(\gamma)$. Procceeding inductively we see that the same is true for any refinement of $\{ I_j \}$. Now any two partitions have a common refinement which proves c).
Note that the proof has to be continued by showing that $f(\gamma)$ depends only on $[\gamma]$. But that is another story.