How to Insert a Node between another node in a Linked List?
You are creating a new node that isn't part of the list with the line:
prev_data2 = Node(prev_data)
prev_data
seems to be the value you're searching for that you want to insert in from of.
Then you connect your new node to that, but since it's not part of the list, it's kind of orphaned. You don't need that node. Just connect your new node to the one you just found:
while thisval is not None:
if thisval.data == prev_data: # you found the node before the insert
new_node.nextNode = thisval.nextNode # new node's next gos to found node's next
thisval.nextNode = new_node # found node's next goes to new node