# Python can also be used as a scripting engine in Microsoft's Active Scripting architecture

**URL:** <https://discuss.python.org/t/python-can-also-be-used-as-a-scripting-engine-in-microsofts-active-scripting-architecture/8109>\
**Category:** Python Help\
**Tags:** help\
**Created:** [April 6, 2021, 11:50am UTC](https://discuss.python.org/t/python-can-also-be-used-as-a-scripting-engine-in-microsofts-active-scripting-architecture/8109 "2021-04-06T11:50:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rh\_galaxy](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rh\_galaxy](https://discuss.python.org/u/rh_galaxy)\
**Post date:** [April 6, 2021, 11:50am UTC](https://discuss.python.org/t/python-can-also-be-used-as-a-scripting-engine-in-microsofts-active-scripting-architecture/8109/1 "2021-04-06T11:50:10Z")

</div>

As it is stated here: [https://www.python.org/doc/essays/omg-darpa-mcc-position/](https://www.python.org/doc/essays/omg-darpa-mcc-position/)

How can I do as the title says?

Currently I do this

1. Install python-3.9.4-amd64.exe
2. Run “pip install pywin32” in cmd
3. Run this program and check hr after CoCreateInstance

```auto
#include <atlbase.h>
#include <activscp.h>
int _tmain(int argc, _TCHAR* argv[])
{
    HRESULT hr = S_OK;
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

    GUID guid; CLSIDFromProgID(L"Python", &guid); //this does not work in CoCreateInstance (guid is valid)
    //GUID guid; CLSIDFromProgID(L"JavaScript", &guid); //this works in CoCreateInstance
    IActiveScript* script; hr = CoCreateInstance(guid, 0, CLSCTX_INPROC_SERVER, IID_IActiveScript, (void**)&script);

    ::CoUninitialize();
    return 0;
}

```

---

<div class="post-metadata">

**Author:** ![rh\_galaxy](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rh\_galaxy](https://discuss.python.org/u/rh_galaxy)\
**Post date:** [April 6, 2021, 2:18pm UTC](https://discuss.python.org/t/python-can-also-be-used-as-a-scripting-engine-in-microsofts-active-scripting-architecture/8109/2 "2021-04-06T14:18:00Z")

</div>

I think it works now.

```auto
[change the paths to your install path]
install latest python 3
get pywin32
  >pip install pywin32
start search 'environment variables', add PYTHONPATH and PYTHONHOME set both to 'D:\Program\Python3'
also edit PATH to remove duplicates (or other versions of python)
register as active script engine
  >python d:\Program\Python3>python Lib\site-packages\win32comext\axscript\client\pyscript.py

```
