incomment = False
with open('myheader.h') as f:
    for line in f:
        if not incomment:
            line = line.split('//')[0]
if line.startswith('#include'):
    print(line)
break
if '/*' in line:
    incomment = True
if '*/' in line:
    incomment = False
How to get the first #include statement in C++ files using Python regex?