There are 17 example files that are installed with EnergyPlus that show you how to do this.
(py38)julien@ExampleFiles$ cd /usr/local/EnergyPlus-9-4-0/ExampleFiles/
(py38)julien@ExampleFiles$ ls PythonPlugin*.idf | wc -l
17
(py38)julien@ExampleFiles$ ls *.py | wc -l
17
(py38)julien@ExampleFiles$ ls PythonPlugin*
PythonPluginAirflowNetworkOpeningControlByHumidity.idf PythonPluginLrgOff_GridStorageSmoothing.py
PythonPluginAirflowNetworkOpeningControlByHumidity.py PythonPluginPlantLoopOverrideControl.idf
PythonPluginConstantVolumePurchasedAir.idf PythonPluginPlantLoopOverrideControl.py
PythonPluginConstantVolumePurchasedAir.py PythonPluginPlantOperation_largeOff.idf
PythonPluginCurveOverride_PackagedTerminalHeatPump.idf PythonPluginPlantOperation_largeOff.py
PythonPluginCurveOverride_PackagedTerminalHeatPump.py PythonPluginReplaceTraditionalManagers_LargeOffice.idf
PythonPluginCustomOutputVariable.idf PythonPluginReplaceTraditionalManagers_LargeOffice.py
PythonPluginCustomOutputVariable.py PythonPluginTestMathAndKill.idf
PythonPluginCustomSchedule.idf PythonPluginTestMathAndKill.py
PythonPluginCustomSchedule.py PythonPluginThermochromicWindow.idf
PythonPluginCustomTrendVariable.idf PythonPluginThermochromicWindow.py
PythonPluginCustomTrendVariable.py PythonPluginUserDefined5ZoneAirCooled.idf
PythonPluginDemandManager_LargeOffice.idf PythonPluginUserDefined5ZoneAirCooled.py
PythonPluginDemandManager_LargeOffice.py PythonPluginUserDefinedWindACAuto.idf
PythonPluginDiscreteAirSystemSizes.idf PythonPluginUserDefinedWindACAuto.py
PythonPluginDiscreteAirSystemSizes.py PythonPluginWindowShadeControl.idf
PythonPluginLrgOff_GridStorageSmoothing.idf PythonPluginWindowShadeControl.py
It works out of the box too.
(py38)julien@~$ mkdir tmp && cd tmp
(py38)julien@tmp$ cp /usr/local/EnergyPlus-9-4-0/ExampleFiles/PythonPluginCustomSchedule.* .
(py38)julien@tmp$ ls
PythonPluginCustomSchedule.idf PythonPluginCustomSchedule.py
(py38)julien@tmp$ cp /usr/local/EnergyPlus-9-4-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw .
(py38)julien@tmp$ energyplus --version
EnergyPlus, Version 9.4.0-998c4b761e
(py38)julien@tmp$ energyplus -w USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw -d out PythonPluginCustomSchedule.idf
EnergyPlus Starting
EnergyPlus, Version 9.4.0-998c4b761e, YMD=2020.10.13 00:16
Initializing Response Factors
[...]
EnergyPlus Run Time=00hr 00min 1.25sec
EnergyPlus Completed Successfully.