We investigate the possibility of forming single-walled (SWTACNNTs) and double-walled carbon nitride nanotubes (DWTACNNTs) from triazine-based C3N4 sheets (gt-C3N4) that have been synthesized recently, using calculations based on density functional theory. In contrast to the case of single-walled carbon nanotubes, the negative strain energy indicates that SWTACNNTs are appreciably more stable than a single sheet of gt-C3N4. In addition, the SWTACNNTs are chirality-specific semiconductors. Boron doping at a carbon site turns (14,0) SWTACNNT into a magnetic semiconductor, where adjacent p-magnetic centers strongly couple ferromagnetically. Phosphorus doping at a nitrogen site decreases the band gap by more than 0.28 eV. DWTACNNTs are not only more stable than constituent SWTACNNTs but also appreciably more stable than a gt-C3N4 bilayer. The band gap of (10,0)@(20,0) TACNNT is more than 0.48 eV smaller than those of the constituent SWTACNNTs.