ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 20 Mar 2013 04:07:30 +0100Where should I put a user defined function?https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/If I wrote a function and want it to be available in sage as a global function (not in a single worksheet), where should I put it ? I mean what directory within sage directory tree ?
Thanks.Sat, 16 Mar 2013 01:22:58 +0100https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/Answer by ndomes for <p>If I wrote a function and want it to be available in sage as a global function (not in a single worksheet), where should I put it ? I mean what directory within sage directory tree ?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?answer=14655#post-id-14655Provided you have access to the Sage directory tree,
you may put it in an appropriate subfolder of
sage-x.y/devel/sage/sage/
for example in
sage-x.y/devel/sage/sage/misc/
Let's say your file is named myfunctions.py, then
from sage.misc.myfunctions import *
will give you access to all functions defined in myfunctions.py
Sat, 16 Mar 2013 08:58:53 +0100https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?answer=14655#post-id-14655Comment by Kushan.skm for <p>Provided you have access to the Sage directory tree,
you may put it in an appropriate subfolder of</p>
<p>sage-x.y/devel/sage/sage/</p>
<p>for example in </p>
<p>sage-x.y/devel/sage/sage/misc/</p>
<p>Let's say your file is named myfunctions.py, then </p>
<pre><code>from sage.misc.myfunctions import *
</code></pre>
<p>will give you access to all functions defined in myfunctions.py</p>
https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?comment=18044#post-id-18044No module named 'myfunctions'Wed, 20 Mar 2013 04:01:51 +0100https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?comment=18044#post-id-18044Comment by Kushan.skm for <p>Provided you have access to the Sage directory tree,
you may put it in an appropriate subfolder of</p>
<p>sage-x.y/devel/sage/sage/</p>
<p>for example in </p>
<p>sage-x.y/devel/sage/sage/misc/</p>
<p>Let's say your file is named myfunctions.py, then </p>
<pre><code>from sage.misc.myfunctions import *
</code></pre>
<p>will give you access to all functions defined in myfunctions.py</p>
https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?comment=18043#post-id-18043Do you think I should modify `sage-x.y/devel/sage/sage/misc/all.py` ?Wed, 20 Mar 2013 04:07:30 +0100https://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?comment=18043#post-id-18043