Python scripted generative Plugin? Looking for feedback, collaborators

Sending midi is easy using the integrated midi modules. For my test I’ve been using the midi map.

from rtmidi import MidiIn, MidiOut
from rtmidi import midiconstants as mc
from random import randrange

def openport(port_class, classname="Script", port=1):
  midi = port_class()
  available_ports = midi.get_ports()
  port_name = f'{classname} {port_class.__name__} {port}'
  if port_name in available_ports:
    midi.open_port(0)
  else:
    midi.open_virtual_port(port_name)
  return midi

rack = openport(MidiOut)
channel_1 = 175+1

rack.send_message([channel_1, 0, randrange(0, 127)])

With some meta programming and a model of the modules it could read like suggested

macro_oscillator.frequency.rand

But this is just a simple example. I also had a look into the core code. Python 3.8 Assignment expressions could be used to create routing from in- to outports. Just another way of scripting setups :wink: