Import a custom script into PythonModule in HDA?

   168   2   1
User Avatar
Member
115 posts
Joined: 8月 2017
オフライン
Here's what I'm trying to do:




I embedded a custom script in my HDA.

Is there a neat way to somehow execute/interact with logic from scripts adjacent to PythonModule? For example, I'd like to define a class in a separate script and then use it in PythonModule.

Attachments:
custom_script.png (69.6 KB)
python_module.png (35.4 KB)

User Avatar
Member
3 posts
Joined: 9月 2020
オフライン
yeah, certainly can be done.

assuming a have another script called "Editor_PythonModule"
import toolutils

# load in the other python modules in the OTL
editor = toolutils.createModuleFromSection(
    "editor", kwargs["type"], "Editor_PythonModule"
)

editor.blah()

can't remember where i found out how to do this.

cheers,
chrisg
User Avatar
Member
115 posts
Joined: 8月 2017
オフライン
@chris_g I would have never discovered that on my own. Thank you very much, Chris! It works as expected.
  • Quick Links