Skip to content

Instantly share code, notes, and snippets.

@theangryangel
Created April 22, 2025 20:15
Show Gist options
  • Save theangryangel/af80f019aff87a5599c9153793651ee1 to your computer and use it in GitHub Desktop.
Save theangryangel/af80f019aff87a5599c9153793651ee1 to your computer and use it in GitHub Desktop.
pyinsim9 example using uv on Windows

setup uv

uv is an extremely fast Python package and project manager for Python. Highly recommend that you use uv.

winget install -e --id astral-sh.uv

setup git

winget install -e --id Git.Git

create a new python project using uv. We pin to python 3.11 because pyinsim9 wont run on anything newer than 3.11

uv init -p ==3.11.* my-insim-project

cd into my-insim-project

cd my-insim-project

create a venv

A venv is a python virtual environment. It separates this project from everything else on your system to prevent package contamination.

uv venv

Add pyinsim9 to my-insim-project

We're temporarily using a fork because the setup.py file is broken upstream... I'll try and raise a PR at some point.

uv add https://github.com/theangryangel/pyinsim9.git --branch=fix-setup

edit main.py

Put the following into main.py

import pyinsim9 as pyinsim

# Initialize the InSim system
insim = pyinsim.insim('127.0.0.1', 29999, Admin=b'123', IName=b'adsa')

print("Hello world")

# Send message 'Hello, InSim!' to the game
insim.sendm(b"Hello, InSim!")

# Start pyinsim.
pyinsim.run()

Run the project

  • Start up LFS, either with the argument /insim=29999 or by typing /insim=29999 into a chat window.
  • Run uv run main.py
  • It should connect and then stay connected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment