# "java import" in script

**URL:** <https://forum.inductiveautomation.com/t/java-import-in-script/68953>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [January 24, 2023, 7:34am UTC](https://forum.inductiveautomation.com/t/java-import-in-script/68953 "2023-01-24T07:34:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 24, 2023, 1:21pm UTC](https://forum.inductiveautomation.com/t/java-import-in-script/68953/2 "2023-01-24T13:21:23Z")

</div>

Standard function in jython. With some quirks:

- Wildcard imports are not supported for java packages.

- Jython automatically "wraps" java objects with a dynamic subclass of `PyObject`, creating matching methods and fields. When such a wrapped object is handed to a true java method that doesn't take a PyObject, but does take the inner java type, the wrapper is automatically stripped back off.

- Python native types are marshalled into similar java types. SImilar in reverse for java primitive types. Jython has a central system for managing and customizing this marshalling and unmarshalling process. See this related topic:

> [@Transaction groups triggered expression item updating when trigger is false](https://forum.inductiveautomation.com/t/transaction-groups-triggered-expression-item-updating-when-trigger-is-false/17196/15):
>
> Thank you very much for the quick fix. Been testing this new beta on a few use cases and haven’t issued any gotchas yet slight_smile

- java's `getXyz()` and `setXyz(val)` are automatically mapped to jython property `xyz` via jython's internal java machinery that implements `@property`. So both the original java methods and a python-style property become available on such "NetBeans" objects. Using the property is fewer opcodes for the jython interpreter, so should be used wherever applicable.

---

_[View the full topic](https://forum.inductiveautomation.com/t/java-import-in-script/68953)._
