Is there a straightforward way to use a variable for the tangle file? For example, I want to tanlge my file into the directory files
. For multiple files I could do
#+begin_src python :tangle files/fileA.py
some code
#+end_src
#+begin_src python :tangle files/fileB.py
some code
#+end_src
But that would mean repeating the file path every time. So ideally I would do something like
#+name: mydir
: files/
#+name: combine
#+begin_src python :var filename=""
return files+filename
#+end_src
#+begin_src python :tangle combine(fileA.py)
some code
#+end_src
#+begin_src python :tangle combine(fileB.py)
some code
#+end_src
But that doesn't work.
I tried using :dir
instead but that doesn't work either, as it seems to apply to the execution directory, not the tangle directory.
I have found this post that shows how to use elisp variables but that requires the use of setq
and doesn't seem like a good idea.