.. _method-external_python:

"""""""""""""""
external_python
"""""""""""""""


Use the external python methods interface



.. toctree::
   :hidden:
   :maxdepth: 1

   method-external_python-id_method
   method-external_python-output
   method-external_python-final_solutions
   method-external_python-class_path_and_name
   method-external_python-options_file


**Specification**

- *Alias:* None

- *Arguments:* None


**Child Keywords:**

+-------------------------+--------------------+-------------------------+-----------------------------------------------+
| Required/Optional       | Description of     | Dakota Keyword          | Dakota Keyword Description                    |
|                         | Group              |                         |                                               |
+=========================+====================+=========================+===============================================+
| Optional                                     | `id_method`__           | Name the method block; helpful when there are |
|                                              |                         | multiple                                      |
+----------------------------------------------+-------------------------+-----------------------------------------------+
| Optional                                     | `output`__              | Control how much method information is        |
|                                              |                         | written to the screen and output file         |
+----------------------------------------------+-------------------------+-----------------------------------------------+
| Optional                                     | `final_solutions`__     | Number of designs returned as the best        |
|                                              |                         | solutions                                     |
+----------------------------------------------+-------------------------+-----------------------------------------------+
| Required                                     | `class_path_and_name`__ | Specify the module and class name of the      |
|                                              |                         | external python method                        |
+----------------------------------------------+-------------------------+-----------------------------------------------+
| Optional                                     | `options_file`__        | Filename to pass to exteral python methods    |
+----------------------------------------------+-------------------------+-----------------------------------------------+

.. __: method-external_python-id_method.html
__ method-external_python-output.html
__ method-external_python-final_solutions.html
__ method-external_python-class_path_and_name.html
__ method-external_python-options_file.html



**Description**


This is an experimental capability that allows the user to expose
python algorithms to Dakota as top-level Iterators.  The Dakota model
is available to python and supplies function, gradient, and hessian
responses as appropriate in addition to helper functions for model
queries and output to the Dakota output stream.

The code example below shows class initialization which outputs the
wrapped model 'executor' docstring.




**Examples**



.. code-block::

  import ext_method

  class RandomSample:

      def __init__(self, executor, params_file=None):
          self.executor = executor
          help(self.executor)



