ReIm:={Re[#],Im[#]}&
ComPolar[{z_,f_}]:={Re[z],Im[z],f}
Torus[{a_,b_,ϕ_}]:={(1+a)Sin[ϕ],(1+a)Cos[ϕ],b}
τArg:=Mod[Arg[#],2π]&
Rot[Ω_]:=RotationTransform[Ω,{0,0,1}]
Unwrap[z_]:={Abs[z]-3,τArg[z]}
ComPolar2[{{a_,b_},f_}]:={a,b,f};

p=2;
q=3;

m=p/q;
m2=q/p;
τArg:=Mod[Arg[#],2π]&

f[x_]:=
Piecewise[Flatten[Table[{{m (x-2π k/p),2k π/p≤x<(2k+1)π/p},{-m (x-2π k/p)+2π/q,(2k+1) π/p≤x<(2k+2)π/p}},{k,0,p}],{1,2}]]
f2[x_]:=
Piecewise[Flatten[Table[{{m (x-2π k/p) - π/(2q),2k π/p≤x≤(2k+1)π/p},{-m (x-2π k/p)+2π/q- π/(2q),(2k+1) π/p≤x≤(2k+2)π/p}},{k,0,p}],{1,2}]]
g[x_]:=
Piecewise[Flatten[Table[{{m2(x-2π k/q),2k π/q≤x<(2k+1)π/q},{-m2(x-2π k/q)+2π/p,(2k+1) π/q≤x<(2k+2)π/q}},{k,0,q}],{1,2}]]
g2[x_]:=
Piecewise[Flatten[Table[{{m2 (x-2π k/q) - π/(2p),2k π/q≤x≤(2k+1)π/q},{-m2(x-2π k/q)+2π/p- π/(2p),(2k+1) π/q≤x≤(2k+2)π/q}},{k,0,q}],{1,2}]]

Plot[Table[f[x]+n 2 π/q,{n,0,q}],{x,0,2π},PlotRange->{{0,2π},{0,2π}}]
Plot[Table[g[x]+n 2 π/p,{n,0,p}],{x,0,2π},PlotRange->{{0,2π},{0,2π}}]

knot=ParametricPlot3D[Table[{Cos[ ((q θ)/p)+2π k/p],Sin[((q θ)/p)+2π k/p],θ},{k,0,p}],{θ,0,2π},PlotStyle->{Thick,Blue}];

insidewashers=Table[ComPolar[{r Exp[I (θ-π/(2p))], ((Abs[r Exp[I θ]])^4)f2[τArg[r Exp[I θ]]]+2π n/q}],{n,0,q}]//ComplexExpand;
outsidewashers=Table[Rot[0]@Torus@Rot[0]@ComPolar2[{Unwrap@(r Exp[I (θ-π/(2q))]), ((Abs[r Exp[I θ]])^4)g2[τArg[r Exp[I θ]]]+2π n/p}],{n,0,p}]//ComplexExpand//Simplify;

Show[
knot,
ParametricPlot3D[outsidewashers,{r, 0,1},{θ,0,2π},Mesh->None,PlotRange->All,PlotPoints->20,PlotStyle->Orange],
ParametricPlot3D[insidewashers,{r, 0,1},{θ,0,2π},Mesh->None,PlotRange->All,PlotPoints->20,PlotStyle->Green,Exclusions->True],

PlotRange->{{-2,2},{-2,2},{0,2π}}
]