import re, sys
// Filter through the classes to find those in CamelCase
camel_case_name = re.compile("([A-Z][a-z0-9]*)+")
module = sys.modules[__name__]
for name in filter(camel_case_name.match, dir(notebook_pb2)):
setattr(module, name, getattr(notebook_pb2, name))
After Change
// Append the current path to the paths to get imports working properly.
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(dir_path)
from Chart_pb2 import Chart
from Div_pb2 import Div
from Element_pb2 import Element