From mboxrd@z Thu Jan 1 00:00:00 1970 From: Divan Santana Subject: documenting python module examples in orgmode Date: Mon, 09 Dec 2019 12:38:58 +0200 Message-ID: <87k175dbr1.fsf@santanas.co.za> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:60247) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieGaq-0006Z0-Sw for emacs-orgmode@gnu.org; Mon, 09 Dec 2019 05:48:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieGap-0000sm-Pv for emacs-orgmode@gnu.org; Mon, 09 Dec 2019 05:48:44 -0500 Received: from [156.0.193.126] (port=42613 helo=mail.santanas.co.za) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ieGap-0000fx-FQ for emacs-orgmode@gnu.org; Mon, 09 Dec 2019 05:48:43 -0500 Received: from authenticated-user (mail.santanas.co.za [156.0.193.126]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.santanas.co.za (Postfix) with ESMTPSA id 9FC615F5C9 for ; Mon, 9 Dec 2019 12:39:00 +0200 (SAST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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.