Refactor getting commands from Python modules.