In the Fourth Gospel, I have found it is helpful to regard the word "light" as usually meaning "life" - in particular resurrected eternal life. Light means more than this, because words in Greek 2000 years ago has multiple and simultaneous meanings - but thinking of light as life as a first approximation, can be helpful.
This helps understand what Jesus is saying towards the end of the 12th Chapter. You can read the whole thing here; but I am going to select what I believe are the important and original passages on a particular theme of light and life.
Selected, because some parts of the 12th Chapter strike me a probable later additions by another hand; of an interpretative and commentary nature; thereby interpolating sometimes alien theological assumptions or church-justifying practices.
I have included my own interpretative notes in italics. These notes are abbreviated, and made themselves be unclear - but maybe they will provide helpful hints on what Jesus is getting at - and what he is not getting at
[24] Verily, verily, I say unto you, Except a corn of wheat fall into the ground and die, it abideth alone: but if it die, it bringeth forth much fruit.
We all (including Jesus himself) need to die in order to attain resurrected, eternal Heavenly life.
[25] He that loveth his life shall lose it; and he that hateth his life in this world shall keep it unto life eternal.
Those who make this mortal life their priority, will not achieve resurrection; only those who recognize that our ultimate destination and gratification lies on the other side of death, will attain everlasting life.
"Hateth" is intended in a non literal, not absolute, and relative sense - Jesus means that all the value of life in this world is given by the reality of life after resurrection.
[26] If any man serve me, let him follow me; and where I am, there shall also my servant be: if any man serve me, him will my Father honour.
Jesus is saying he will die and be resurrected (where I am), and those who love him may follow this same path to be in the same place and state - and that this following is the path to eternal life in Heaven - anyone who does, in this sense of "follow" Jesus, will follow the same path to Heaven.
In other word; Jesus is Not asking men to serve him as servants as a pre-requisite and price necessary to being allowed eternal life. From context this would be utterly alien to teachings of the Gospel and Chapter. He is saying that nature of the "service" Jesus requires is to "follow" him.
[31] Now is the judgment of this world: now shall the prince of this world be cast out.
Jesus is announcing that Men may henceforth escape from the devil, may live only by good and free from all evil - as made clear before, this is escape on the other side of death. In other words; the escape from evil is via resurrection.
[32] And I, if I be lifted up from the earth, will draw all men unto me.
Jesus, in being "lifted up" from the earth, will attain resurrected Heavenly life in "Heaven" - which word includes the meaning of sky; and by love of Jesus all men may choose to follow where he has gone "up" into Heaven. I think that "drawing" us to Heaven is meant as a variation on the path being by following Jesus: Jesus makes the path, and all we need to do is follow that path.
(Contra the omitted following verses; this verse is not about Jesus being raised from the ground by the execution process of killing somebody on a cross! That is not the subject of this discourse.)
[35] Then Jesus said unto them, Yet a little while is the light with you. Walk while ye have the light, lest darkness come upon you: for he that walketh in darkness knoweth not whither he goeth.
[36] While ye have light, believe in the light, that ye may be the children of light.
Probably controversially (!); I think this is not primarily Jesus talking about himself as "the light" and that he will soon die; but instead Jesus talking about mortal life, and how mortal life should be conducted (i.e. our proper attitude to living) while yet we still live - i.e. before we die.
I think Jesus is saying that we need to attend to our mortal lives (walk while ye have the light), while we live. The alternative is that darkness will come upon you - that you will die - and Not be resurrected. "He that walketh in darkness" is one who denies the reality or possibility of eternal life; and therefore knows not what will happen, where he will go, after death.
While we are alive - while we have light - we ought to believe in the light: that is, we ought to acknowledge the significance of this mortal life.
"While ye have light, believe in the light, that ye may be the children of light." I think Jesus is implying that, on the one hand our ultimate priority must be eternal resurrected life. But on the other hand - while we live now, although this mortal life is temporary, we have important work to do. We ought not to wish our mortal lives away.
Profoundly; to be children of eternal life entails that we be children of this mortal life. It is neither atheistic materialism and its exclusive focus on this mortal incarnate life; nor the life-denying philosophies that regard embodied mortal life as profoundly negative and yearn for eternal life (typically as spirits).
Even more strongly, if we do Not give this mortal life its due importance, we are also becoming children of darkness and not children of life: we are embracing death and not resurrection.
[46] I am come a light into the world, that whosoever believeth on me should not abide in darkness.
[47] And if any man hear my words, and believe not, I judge him not: for I came not to judge the world, but to save the world.
Roughly speaking; Jesus is reaffirming that his "job" is to bring "light" to the world, that is - resurrected eternal Heavenly life.
Darkness is the death which is ghost-like severance of spirit from body (the Sheol of the Ancient Hebrews, the Hades of the Ancient Greeks), in which men abode until Jesus made possible resurrection.
Not as a judge, implies that Jesus is offering this as a gift, as a possibility, available to all men by their own choice, and not in terms of some judgment of Jesus about our suitability.
Overall; Jesus is talking about the new possibility of resurrection, and how attaining this gift is made possible.