![]() | Accessing Regina from Python |
Prev | Python Scripting | Next |
All of Regina's objects, classes and methods belong to the
module called regina
.
For instance, you can create a new triangulation by calling
regina.NTriangulation()
, and you can read a data file
by calling regina.readFileMagic(filename)
.
Whenever Regina gives you access to Python (either through a
graphical console,
a script packet or a
command-line session),
it will automatically import the regina
module for you to use.
If you have code that you find yourself writing again and again,
you can put it in a user library.
Regina will run all of the code in all of your user libraries
at the beginning of every Python session
(including graphical consoles, script packets
and regina-python).
User libraries are just ordinary Python files: you can maintain
the current list of enabled libraries through
Regina's Python options
(or if you prefer, through the file ~/.regina-libs
as described in the
regina-python
reference).