If you want to use the literate programming features in emacs org-mode, you can try this minimal example to get started: Activate org-babel-tangle, then put this into the file noweb-test.org
:
Minimal example for noweb in org-mode
* Assign
First we assign abc:
#+begin_src python :noweb-ref assign_abc
abc = "abc"
#+end_src
* Use
Then we use it in a function:
#+begin_src python :noweb tangle :tangle noweb-test.py
def x():
<<assign_abc>>
return abc
print(x())
#+end_src