# Plugin ↔ Plugin

Given that there are two plugins `PluginA` and `PluginB` , it is possible to call methods / access each other using the **PluginManager**.

A reference to the build `*.dll` of the other plugin is required in the solution, similiar to the `HogWarpSdk.dll` reference done in [Creating a Plugin](/hogwarp/scripting/server-side/plugin/creating-a-plugin.md#configure-the-project).

{% hint style="info" %}
Make sure to only access another plugin earliest in the `PostLoad` lifecycle, as it is not guaranteed to be loaded if called earlier.
{% endhint %}

## Example

{% code title="PluginA.cs" lineNumbers="true" %}

```csharp
namespace PluginA;

public class Plugin : HogWarpSdk.IPlugin
{
    public string Author { get; } = "YourName";
    public string Name { get; } = "PluginA";
    public Version Version { get; } = new(1, 0, 0, 0);
    
    public Plugin() { }

    public void PostLoad() { }

    public void Shutdown() { }
    
    public void DoSomething() 
    {
        // This method is called from a different plugin
    }
}
```

{% endcode %}

{% code title="PluginB.cs" overflow="wrap" %}

```csharp
namespace PluginB;

public class Plugin : HogWarpSdk.IPlugin
{
    public string Author { get; } = "YourName";
    public string Name { get; } = "PluginB";
    public Version Version { get; } = new(1, 0, 0, 0);
    
    public Plugin() { }

    public void PostLoad() 
    { 
        _logger.Info("Post load");

        var pluginA = HogWarpSdk.Server.PluginManager.Get<PluginA.Plugin>();
        if (pluginA != null)
        {
            _logger.Info($"PluginA found, version {pluginA.Version}");
            pluginA.DoSomething();
        }
        else
        {
            _logger.Info("PluginA not found");
        }
    }

    public void Shutdown() { }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hogwarp.com/hogwarp/scripting/server-side/plugin/plugin-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
