I am attempting to add [rlcompleter][1] functionality to my fork from the IronTextBoxControl2 in RevitPythonShell.

However, I am getting a tough challenge with the road:

import __primary__

in rlcompleter.py. The reason being I do not have this type of module. I've been searching / browsing with the IronPython 2. codebase trying to puzzle out how you can create a module.

It appears I'm able to achieve this from a clear case of IronPython.Runtime.PythonContext using the method PublishModule(string title, PythonModule module). But I am getting challenge with the next:

  • acquiring a PythonContext instance
  • acquiring a PythonModule instance

Things I have, is really a ScriptEngine along with a ScriptScope. I would like the scope to become released because the module __primary__. When I understand, the scope has already been connected to the module, however i can't learn how to can get on.

This is actually the reason for code Let me tie this together:

    /// <summary>

    /// Setup an IronPython atmosphere - for interactive spend or canned scripts

    /// </summary>

    public void SetupEnvironment(ScriptEngine engine, ScriptScope scope)

    Been successful)

        // add preconfigures variables

        scope.SetVariable("__vars__", RevitPythonShellApplication.GetVariables())

        /* register scope as __primary__ module here?! */

        // add the search pathways

        AddSearchPaths(engine)