A slightly better solution is the following:
(defmethod restas:module-context ((module symbol))
(second (gethash module (restas::pkgmodule-traits-modules *package*))))
Then you can access the context for the module with module-context
, for example:
(with-context (module-context 'sub)
m1:*a*)
Or better yet:
(with-module 'sub
m1:*a*)
Note that you use the name you used when mounting the module, not the name of the package you mounted.
UPDATE: The method I described has been added to RESTAS.