Hi All,

I'm trying to document python module examples in orgmode.

I'm sure this is possible, but not quite sure how to do it.

I'd like to define the python module in one block, and then import it in
another.

#+NAME: my_module.py
#+begin_src python
print('Importing my_module...')

test = 'Test String'

def find_index(to_search, target):
    '''Find the index of a value in a sequence'''
    for i, value in enumerate(to_search):
        if value == target:
            return i

    return -1
#+end_src

#+NAME: intro.py
#+begin_src python
import my_module

courses = [ 'History', 'Math', 'Geography', 'Science' ]
#+end_src

How can one do this?

Thanks very much.

Reply via email to