# system.tag.readBlocking not working with client tags from inside a shared project library

**URL:** <https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533>\
**Category:** Ignition\
**Tags:** ignition80, ignition81\
**Created:** [October 30, 2021, 9:21pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533 "2021-10-30T21:21:23Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [October 30, 2021, 9:21pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/1 "2021-10-30T21:21:23Z")

</div>

system.tag.read(tag) from or the newer system.tag.radBlocking fails to return the client tags when called from a script in the the Project Library, but works just fine when you have it in a event handler.

This works fine in the event handler;  
DataColorsPath=’[client]\_System/Appearance/EntryForm’  
print system.tag.read(DataColorsPath+’/DataValid’)  
print system.tag.read(DataColorsPath+’/DataValid’).value  
print system.gui.color(system.tag.read(DataColorsPath+’/DataValid’).value)

But if you put this in a project library;  
shared.EAM.GUI.Entry.BkTxtMaxLen(event,DataColorsPath=’[client]\_System/Appearance/EntryForm/DataValid’)

def BkTxtMaxLen(Event,DataColorsPath=’[Client]\_System/Appearence/EntryForm’):

| | print DataColorsPath |
| --- | --- |
| | print system.tag.readBlocking([DataColorsPath+’/DataValid’])[0] |
| | print system.tag.read(DataColorsPath+’/DataValid’) |

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [October 30, 2021, 9:29pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/2 "2021-10-30T21:29:36Z")

</div>

Sorry last post posted before the library code was pasted in;

def BkTxtMaxLen(Event,DataColorsPath=’[Client]\_System/Appearence/EntryForm’):   
print DataColorsPath  
print system.tag.readBlocking([DataColorsPath+’/DataValid’])[0]  
print system.tag.read(DataColorsPath+’/DataValid’)

Well just return;  
[client]\_System/Appearance/EntryForm/DataValid  
[null, Bad\_NotFound, Sat Oct 30 13:46:52 PDT 2021 (1635626812978)]  
[null, Bad\_NotFound, Sat Oct 30 13:46:52 PDT 2021 (1635626812979)]

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 30, 2021, 9:35pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/3 "2021-10-30T21:35:04Z")

</div>

You defined it in a project library but where are you calling it from?

---

<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:** [October 30, 2021, 10:05pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/4 "2021-10-30T22:05:14Z")

</div>

Kevin is hinting at the fact that project libraries, by themselves, have no scope. Their scope is determined by from where they are called. A gateway event can call a project script and it will be gateway scope. A Vision client event or component event can call the same script and it will be Vision client scope.

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [November 1, 2021, 2:59pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/5 "2021-11-01T14:59:15Z")

</div>

I’m calling it from the event it’s self. In 7.9 we have these library calls on all of are objects on the form. It basically changes the color of the background the text object should they enter text that is to long to be entered into the data base. But in 8.0 and 8.1 in doing so now you get a bad tag reference. In the above code, the tags print just find in the event, then in the same event I make a call to BkTxtMaxLen and have the same print statements, but they return tag not found. (Is there a import of some sort I have to do in version 8?)

---

<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:** [November 2, 2021, 12:06pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/6 "2021-11-02T12:06:05Z")

</div>

> [@ghuck](#):
>
> the event it’s self

What event is that?

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [November 3, 2021, 10:02pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/7 "2021-11-03T22:02:53Z")

</div>

On the property change event the one one line of code is;

shared.EAM.GUI.Entry.BkTxtMaxLen(event)

The full code in this library is;

```auto
def BkTxtMinMaxLen(Event,MinLen,DataColorsPath='[Client]_System/Appearence/EntryForm'):	
	"""Written:06/30/20 By:Gerry Huck Last Rev: / / By: Rev 1.0b
	Background color of a text widget when the under the min or larger then the max length, called from a propertyChange event.
	For Text widgets set props to MDeferUpdates=0, CommitOnFocusLoss=1, RejectUpdatesDuringEdit=1"""
	if Event.propertyName == 'text':
		if len(Event.source.text) > MinLen:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataValid').value)
		else:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataRequired').value)
	elif Event.propertyName == 'editValid':
		if len(Event.source.text) > Event.source.maxChars:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataError').value)
		else:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataValid').value)

```

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [November 3, 2021, 10:17pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/8 "2021-11-03T22:17:03Z")

</div>

Sorry grab the wrong library although it will do the same thing;

```auto
def BkTxtMaxLen(Event,DataColorsPath='[Client]_System/Appearence/EntryForm'):	
	"""Written:04/15/17 By:Gerry Huck Last Rev: : : By: Rev 1.0
	Background color of a text widget when the max length has been reached, called from a propertyChange event.
	For Text widgets set props to MDeferUpdates=0, CommitOnFocusLoss=1, RejectUpdatesDuringEdit=1"""
	if Event.propertyName == 'text':
		if len(Event.source.text) <= Event.source.maxChars:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataValid').value)
	elif Event.propertyName == 'editValid':
		if Event.newValue:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataValid').value)
		else:
			Event.source.editableBackground = system.gui.color(system.tag.read(DataColorsPath+'/DataError').value)

```

---

<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:** [November 3, 2021, 11:29pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/9 "2021-11-03T23:29:50Z")

</div>

Huh. I’m stumped.

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [November 4, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/10 "2021-11-04T14:54:37Z")

</div>

I was hoping there was a simple solution. Would it be better if I open a call with support. The reason I went this route is my 8.1 test box does not have a license on it. I’m I’m starting to test all of are licensed 7.9.+ systems on that test box before putting together a upgrade plan for next year.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 4, 2021, 3:38pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/11 "2021-11-04T15:38:55Z")

</div>

I’m curious, try adding `import system` to the shared script.

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [November 4, 2021, 8:14pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/12 "2021-11-04T20:14:48Z")

</div>

Had no affect, tag still return as Bad\_NotFound.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 4, 2021, 8:16pm UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-with-client-tags-from-inside-a-shared-project-library/52533/13 "2021-11-04T20:16:50Z")

</div>

It was a shot in the dark. I had some weird things happening in perspective when using global scripts in the script console that needed to `Import system` to work.
