Required function input types in PyJulia

I have a function in Julia that is called from Python and it seems to be enforcing a particular argument type, but I’m not sure how/where because when I change the allowed argument type to what should be the correct thing (or even Any), it does not fix the problem. It’s kind of a long story, so bear with me.

Here’s the pseudo-code that used to work. I defined a new structure type in Julia, let’s call it NewType.

struct NewType
   function NewType(; field1::Float64, field2::Float64)
      new(field1, field2)

Then I had a Julia function that used that type as an argument,

function NewFunction(arg1::NewType)
   do some stuff
   return out

Then I called this function from Python. Here are pieces of the code:

def generate_julia_obj(self):
   return NewType(field1 = field1, field2 = field2)

arg1 = self.generate_julia_obj()
out = NewFunction(arg1 = arg1)

This used to work, but I recently made a change that broke this. I made NewType inherit from FieldVector and now the Python function generate_julia_obj outputs <class ‘list’> instead of <class ‘PyCall.jlwrap’>. So I have two questions.

  1. Is there a way for NewType to inherit from FieldVector that won’t change the type in Python to a list?
  2. I tried changing the argument type in NewFunction to
function NewFunction(arg1::Union{NewType,Vector{Float64}})

(and in an attempt to get it to work I even tried changing the argument type to Any), but for some reason that didn’t help and Python still said that there was a Julia type error and that function was expecting NewType and I don’t understand what’s going on. Any ideas?