Shellac is the standard material to deal with knots. It is not very good as a finish, but is very good as a block. The stain is resin moving its way through the wood and past the coats of paint. You should sand the coats of paint off the wood and, before applying shellac to the surface, apply a small amount of paint cleaner to the knot itself. It will not penetrate the knot very deeply, but enough so that the shellac, when applied, will hold much better. There are some stain-block paints on the market that are, in fact, white shellacs. Make sure that the shellac is less than a year old, and mix it well before applying.