I am trying to load a namespace from a file during runtime. For this namespace I would like to have a common alias, so I can access functions from that namespace with a unified, qualified name independent from the actual namespace of the loaded file.
Example (not working):
;; bar_a.clj (ns bar-a) (defn hello-world [] "hello world a") ;; bar_b.clj (ns bar-b) (defn hello-world [] "hello world b") ;; foo.clj (ns foo) (defn init [ns-name] (let [ns-symbol (symbol ns-name)] (require `[ns-symbol :as bar]) (bar/hello-world))) ;; => No such var bar/hello world ;; during runtime when calling `init`!!!
I already tried various things (load-file
, load
) and moving the require
to different places. No luck so far.
How can I achieve that?