don't know much about cdi units with immobiliser, but it could be possible the unit is faulty. if you can find anywhere to test it, or there are units available that bypass the immobiliser. if it was carburettor from cold start you would get some response before the engine started. I think cdi units are transformer based which means you need one charge to enable another circuit, like a relay. also if your machine has a safety switch where you need to pull a brake lever to begin the ignition circuit, the relay for this circuit could also be faulty (this relay can be cleaned, take the top off and clean the contacts) I'm not great with circuits but this might help.
Hi cheers for you reply I will give this ago today but the bike has no imobiliser and you don’t have to pull the brakes to use the starter moter
sorry to hear you had no luck. CDI box is the only thing I can suspect. but I don't want to send you on the wrong road. let me know if you have any success.
if it's cranking and cranking but not starting, is the plug getting soaking wet? It should be. If it's cranking and cranking and the plug is bone dry, then there is possibly a vacuum problem. I know you say you already have a new piston and barrel, but do a compression test, just to rule out low compression.
its when you say the bike is ok then just cuts out like the ignition switched off, means there is a break or the spark is shorting.