However in your case I would strongly recommend against trying to do that, and instead recommend that you put the constants into your .msg file so that as you've noticed they'll be easily available in python, but also in C++ and any other language for which a node is written. They will all share the constant values in all languages using the autogenerated code.