> ## Documentation Index
> Fetch the complete documentation index at: https://private-04b27de1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.coding.func_with_reqs.FunctionWithRequirements

<h2 id="autogen.coding.func_with_reqs.FunctionWithRequirements" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">FunctionWithRequirements</span>
</h2>

```python theme={null}
FunctionWithRequirements(
    func: Callable[~P, ~T],
    python_packages: list[str] = &lt;factory&gt;,
    global_imports: list[str | ImportFromModule | Alias] = &lt;factory&gt;
)
```

FunctionWithRequirements(func: Callable\[\~P, \~T], python\_packages: list\[str] = `<factory>`, global\_imports: list\[typing.Union\[str, autogen.coding.func\_with\_reqs.ImportFromModule, autogen.coding.func\_with\_reqs.Alias]] = `<factory>`)

<b>Parameters:</b>

| Name              | Description                                                                                                                                                                                                           |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `func`            | **Type:** Callable\[\~P, \~T]                                                                                                                                                                                         |
| `python_packages` | **Type:** list\[str]<br /><br />**Default:** \<factory>                                                                                                                                                               |
| `global_imports`  | **Type:** list\[str \| [ImportFromModule](/docs/api-reference/autogen/coding/func_with_reqs/ImportFromModule) \| [Alias](/docs/api-reference/autogen/coding/func_with_reqs/Alias)]<br /><br />**Default:** \<factory> |

### Static Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### from\_callable

```python theme={null}
from_callable(
    func: Callable[~P, ~T],
    python_packages: list[str] = [],
    global_imports: list[str | ImportFromModule | Alias] = []
) -> FunctionWithRequirements[~T, ~P]
```

<b>Parameters:</b>

| Name              | Description                                                                                                                                                                                                    |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `func`            | **Type:** Callable\[\~P, \~T]                                                                                                                                                                                  |
| `python_packages` | **Type:** list\[str]<br /><br />**Default:** \[]                                                                                                                                                               |
| `global_imports`  | **Type:** list\[str \| [ImportFromModule](/docs/api-reference/autogen/coding/func_with_reqs/ImportFromModule) \| [Alias](/docs/api-reference/autogen/coding/func_with_reqs/Alias)]<br /><br />**Default:** \[] |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### from\_str

```python theme={null}
from_str(
    func: str,
    python_packages: list[str] = [],
    global_imports: list[str | ImportFromModule | Alias] = []
) -> FunctionWithRequirementsStr
```

<b>Parameters:</b>

| Name              | Description                                                                                                                                                                                                    |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `func`            | **Type:** str                                                                                                                                                                                                  |
| `python_packages` | **Type:** list\[str]<br /><br />**Default:** \[]                                                                                                                                                               |
| `global_imports`  | **Type:** list\[str \| [ImportFromModule](/docs/api-reference/autogen/coding/func_with_reqs/ImportFromModule) \| [Alias](/docs/api-reference/autogen/coding/func_with_reqs/Alias)]<br /><br />**Default:** \[] |

<br />

### Instance Attributes

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### func

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### global\_imports

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### python\_packages

<br />

<br />
