diff --git a/modules/seq/base/pymod/export_hmm.cc b/modules/seq/base/pymod/export_hmm.cc
index 72a072215b33285509424a35e8f80dcb9db8265b..1d9b39e28d3d12f4cdfca73b9c66031c71200c2c 100644
--- a/modules/seq/base/pymod/export_hmm.cc
+++ b/modules/seq/base/pymod/export_hmm.cc
@@ -50,6 +50,7 @@ void export_hmm()
   ;
 
   class_<HMM, HMMPtr>("HMM", init<>())
+    .def("__len__",&HMM::size)
     .def("Load", &HMM::Load).staticmethod("Load")
     .def("AddColumn", &HMM::push_back)
     .def("Extract", &HMM::Extract)