Libraries
Libraries are files that contain reusable functions. For example std.cst is the default standard library that provides the basic res, cap, net, etc. components.
For large schematics, it is often easier to organize code into separate libraries.
Importing libraries
The import keyword is used to import libraries into the current file and there are 3 ways that the import keyword is used.
Import with library name
import <libraryName>
All functions are imported into the current file. The <libraryName> must be included when calling library functions.
import std
vcc = std.supply("5V")
gnd = std.dgnd()
at vcc
wire down 100
add std.res(10k)
wire down 100
to gnd
Named imports
from <libraryName> import <func1>, <func2> ...
Imports only specific named functions. The imported library functions are called directly without including the <libraryName>.
from std import supply, dgnd, res
vcc = supply("5V")
gnd = dgnd()
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
Wildcard imports
from <libraryName> import *
This imports all functions within the library into the current function. The imported library functions are called directly without including the <libraryName>.
from std import *
vcc = supply("5V")
gnd = dgnd()
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
Named imports are preferred as it is easier to determine what functions are imported into the current code.