diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 83509209c3..7bf91641be 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -1,7 +1,7 @@ add_subdirectory(example_scripts) add_subdirectory(tests) -set(PYEXEC_FILES __init__.py function_class.py gnucash_business.py gnucash_core.py) +set(PYEXEC_FILES __init__.py function_class.py gnucash_business.py gnucash_core.py app_utils.py) set(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/time64.i) set(GNUCASH_CORE_C_INCLUDES diff --git a/bindings/python/app_utils.py b/bindings/python/app_utils.py new file mode 100644 index 0000000000..82d809ce60 --- /dev/null +++ b/bindings/python/app_utils.py @@ -0,0 +1,16 @@ +# app_utils.py -- High level python wrapper for app-utils +# +# @author Christoph Holtermann +## @file +# @brief High level python wrapper for app-utils +# @ingroup python_bindings + +from gnucash import _sw_app_utils + +def gnc_get_current_session(): + from gnucash import Session + return Session(instance=_sw_app_utils.gnc_get_current_session()) + +# further functions in _sw_app_utils +# _gnc_get_current_book is availabe through Session.get_book() +# _gnc_get_current_root_account is available through Session.get_root_account()