ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 19 Mar 2013 22:07:30 -0500Where should I put a user defined function?http://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.Fri, 15 Mar 2013 19:22:58 -0500http://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>
http://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 02:58:53 -0500http://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>
http://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?comment=18044#post-id-18044No module named 'myfunctions'Tue, 19 Mar 2013 22:01:51 -0500http://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>
http://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` ?Tue, 19 Mar 2013 22:07:30 -0500http://ask.sagemath.org/question/9919/where-should-i-put-a-user-defined-function/?comment=18043#post-id-18043