.. _ogn_tutorial_state_py:

Tutorial 13 - Python State Node
===============================

This node illustrates how you can use internal state information, so long as you inform OmniGraph that you are
doing so in order for it to make more intelligent execution scheduling decisions.

OgnTutorialStatePy.ogn
----------------------
The *.ogn* file containing the implementation of a node named "omni.graph.tutorials.StatePy", with an empty state set to
inform OmniGraph of its intention to compute using internal state information.

.. literalinclude:: ../../../../../source/extensions/omni.graph.tutorials/tutorials/tutorial13/OgnTutorialStatePy.ogn
    :linenos:
    :language: json

OgnTutorialStatePy.py
---------------------
The *.py* file contains the compute method and the internal state information used to run the algorithm.

By overriding the special method ``internal_state`` you can define an object that will contain per-node data that
you can manage yourself. It will not be visible to OmniGraph.

.. literalinclude:: ../../../../../source/extensions/omni.graph.tutorials/tutorials/tutorial13/OgnTutorialStatePy.py
    :linenos:
    :language: python
