Cohomology class $ H^k(X; \pi_{k-1}(Y,y_0))$ as obstruction I am following these notes http://scgp.stonybrook.edu/wp-content/uploads/2018/09/lecture-1.pdf
on obstruction theory.
Let $X$ be a CW complex and denote by $X^{(k)}$ its $k$-skeleton. Suppose
that $Y$ is a simply connected space with basepoint $y_0$ and suppose that
$f : X^{(k-1)} \to Y$ is a continuous map. Then the association to each oriented
$k$-cell $e^k \cong D^k$ of $X$ of the element in $\pi_{k-1}(Y,y_0)$
corresponding to the composition
$$   S^{k-1}  \xrightarrow{\eta_{e^k}}  X^{(k-1)} \xrightarrow{f}  Y  $$
where $\eta_{e^k}$ is the is the attaching map for $e^k$, defines a CW $k$-cochain on
$X$ with coefficients in $\pi_{k-1}(Y,y_0)$, called the obstruction cochain for extending $f$ to
the $k$-skeleton. It is denoted $\mathcal{O}(f)$.
Next, there is a Lemma 1.2:
$\mathcal{O}(f)$ is a cocycle. If $g : X^{(k-1)} \to Y $ has the property that
$f \vert _{X^{(k-2)}}  = g \vert _{X^{(k-2)}} $ then  $\mathcal{O}(f) -
\mathcal{O}(g)$ is a coboundary. Conversely, given any
coboundary, $dc$, there is a map $g : X^{(k-1)} \to Y$ agreeing with $f$  on
$ X^{(k-2)}$ such that $\mathcal{O}(f) -\mathcal{O}(g) = dc $.
After the proof in the notes is remarked (see page 2) that in view of this
lemma the cohomology class $ [ \mathcal{O}(f)] \in
H^k(X; \pi_{k-1}(Y,y_0))$ is the obstruction to extending
$ f \vert _{X^{(k-2)}} $ over $X^{(k)} $ in the sense that the cohomology class
$ [\mathcal{O}(f)] $ vanishes if and only if there is such
an extension.
I not understand how to read off from this lemma 1.12 that $ [\mathcal{O}(f)] $ gives an "obstruction class " for extension of $f$ to $k$-skeleton. Could somebody explain it? Unfortunately, this relation between the lemma and obstruction property of $ [\mathcal{O}(f)] $ the remark is refering to is not apparent to me from the script.
#UPDATE#: thanks to the discussion with Mariano below it follows that
the implication "$f$ extends to $X^{(k)} \to Y$ -> class $[O(f)]$
vanishes" has nothing to do with this lemma 1.2. It just follows immediately from
the fact that if $f : X^{(k-1)} \to Y$ extends to $X^{(k)} \to Y$,
then every composition
$S^{k-1}  \xrightarrow{\eta_{e^k}}  X^{(k-1)} \xrightarrow{f}  Y$
factors through $k$-ball $D^k$ which has the attatching sphere $S^{k-1}$ as boundary and therefore $O(f)$ is
zero homotopic.
So my question reduces to the converse implication, namely why
Lemma 1.2 implies or verbatimly "in view of this lemma" we get the implication that if the class $ [ \mathcal{O}(f)] \in
H^k(X; \pi_{k-1}(Y,y_0))$ is zero, then
$f : X^{(k-1)} \to Y$ extends to $X^{(k)}$.
Does maybe the lemma 1.2 in the text contain an error with respect to the right index shift of the $k$'s? Since otherwise I not see how to conclude from the lemma 1.2 that the class $[O(f)]$ is a "obstruction class" in sense the quotedremark on page 2.
 A: Lemma 1.2 can be rephrased as
$$ \{g: [O(g)] = [O(f)] \} =\{g: g|X^{(k-2)} = f| X^{(k-2)} \} $$
It seems like 0 plays no role, so that we can't conclude the "extendable maps" are the one that lies in the class $[O(f)]=0$.
For example, consider the same lemma $O'(f):= O(f)+c$, where  is the fixed element of the involved cochain complex. The lemma would be the same, but the extendable maps would be the ones with $[O'(f)] = [c]$.
Maybe the textbook wanted to argue that the given obstruction parametrizes the extensions from $X^{(k-2)}$ to $X^{(k-1)}$, which is a consequence of the lemma. But it does not solve the extension problem from $X^{(k-1)}$ to $X^{(k)}$. Indeed, note that we should be really writing $O_k(f)$, and this is needed to check the extension to $X^{(k)}$, not to $X^{(k-1)}$.
I would rather say that $[O(f)]$ being an obstruction class plus lemma 1.2 show that extendability only depends on $f| X^{(k-2)}$, which is not a direct consequence of $[O(f)]$ being an obstruction class.
