These examples provide techniques for importing your custom-written Python modules that need to reference the crt scripting object.
To be clear, this approach does not allow scripts running outside of SecureCRT to access the crt scripting object. The crt script object is not available to any process outside of the SecureCRT process itself. SecureCRT populates the script engine with the crt object at runtime; so unless SecureCRT is running the script itself, there is no crt object available to any script engine.
This approach simply allows you to modularize elements of your existing SecureCRT scripts — scripts that must continue to be run from within the SecureCRT process itself.
The main script, ImportModuleWith_crt_Reference.py.txt, which imports the module code, crt_Module.py.txt, performs this sequence of actions:
ImportModuleWith_crt_Reference.py.txt (4.0 KB)
This is the main Python script code. It imports the crt_Module code. The script will work in either Python 2.7 or 3.x.
crt_Module.py.txt (953 Bytes)
This file contains the module code itself. This module is imported by the main script code.
VanDyke Software uses cookies to give you the best online experience. Before continuing to use this site, please confirm that you agree to our use of cookies. Please see our Cookie Usage for details.
Here you can control cookies using the checkboxes below. Some cookies are essential for the use of our website and cannot be disabled. Others provide a convenience to the user and, if disabled, may reduce the ease of use of our site. Finally, some cookies provide anonymous analytic tracking data that help us provide the user with a richer browsing experience. You can elect to disable these cookies as well.